AI Tools
MentraOS provides a powerful way for apps to extend Mira AI’s capabilities through custom tools. These tools allow Mira to take actions within your app, such as creating content, fetching data, or controlling features - all through natural language conversations with users.What Are App Tools?
App tools are functions that your application exposes to Mira AI. When a user asks Mira to perform an action that matches one of your tools, Mira will:- Identify the relevant tool
- Extract necessary parameters from the user’s request
- Call your app with these parameters
- Return your response to the user
Defining Your Tools
Tools are defined in the devloper console. Go to console.mentra.glass/apps and edit your app, then look for the “AI Tools” section.
id
: Unique identifier for the tooldescription
: Human/AI-readable description of what the tool doesactivationPhrases
: Optional comma-separated list of phrases that might trigger this tool (although Mira may also trigger tools based on the context of the conversation)parameters
: Optional list of parameters the tool accepts
Parameter Properties
Each parameter definition has:type
: Data type of the parameter -"string"
,"number"
, or"boolean"
description
: Human/AI-readable description of the parameterrequired
: Whether the parameter is requiredenum
: Optional comma-separated list of allowed values for string parameters (if specified, Mira will choose one of these values)
Implementing Tool Handling
1. Override onToolCall
In your app server, override theonToolCall
method to handle incoming tool calls:
2. Return Values
YouronToolCall
method should return a string that will be passed to Mira’s AI to formulate a response. Alternatively, you can return the special string GIVE_APP_CONTROL_OF_TOOL_RESPONSE
to indicate that Mira should not respond because your app will respond directly.
Common Tool Patterns
CRUD Operations
Todo List Example
Implementation Example
Here’s how to implement a complete todo list app with Mira integration:Tool Call Lifecycle
- Tool Call Detection: Mira AI identifies a tool call based on the tool’s activation phrases
- Parameter Extraction: Mira extracts parameters from the user’s request
- Tool Call Execution: Mira calls the
/tool
endpoint of your app server with the extracted parameters. You don’t need to handle this manually, the SDK handles this for you. - Your App Handles the Tool Call: Your overridden
onToolCall
method is called with the tool call details. You can handle the tool call logic here. - Your App Responds: Your app responds with a text string that Mira’s AI will use to formulate a response. Or you can return
GIVE_APP_CONTROL_OF_TOOL_RESPONSE
to indicate that your app will respond directly. - Mira Responds to the User: Mira uses your response to formulate a response to the user, or call other tools as needed. Your response is not necessarily the final response to the user, it is just information the AI uses to formulate a response. If you return
GIVE_APP_CONTROL_OF_TOOL_RESPONSE
, Mira will not respond to the user.
Related Documentation
- Tool Types Reference - Detailed type definitions for tools
- App Server - onToolCall - API reference for the onToolCall method
- Getting Started with Apps - Complete guide to building an app