Adding tools to your application
You can expose custom agent tools directly from your React Native app. These tools appear under the app domain so coding agents (e.g. CLI, Cursor, Codex) can discover and call them via Rozenite for Agents.
Use this when you want agents to perform app-specific actions—for example, triggering a debug flow, returning build metadata, or driving in-app behavior during automated testing.
Prerequisites
- Rozenite is installed and configured in your app (see Getting started).
- Your app runs in development mode with at least one connected target so the agent bridge can communicate with the Rozenite devtools.
Install the agent bridge
Install @rozenite/agent-bridge as a dependency:
The bridge provides React hooks that register tools with the Rozenite agent plugin, handle incoming tool calls, and send results back to the agent.
Define and register a tool
Each tool has:
- name – Unique identifier (agents will see it as
app.<name>). - description – Short explanation for the agent.
- inputSchema – JSON Schema–style object describing the tool’s arguments.
- handler – Function that receives the parsed arguments and returns a result (or throws).
Use the useRozeniteInAppAgentTool hook inside a component that is mounted when your app is active. The tool is registered on mount and unregistered on unmount.
Example: build info tool
Mount AppAgentTools (or your equivalent) somewhere in your app tree—for example next to your root navigator or DevTools setup—so the tool is available whenever the app is connected.
Example: alert tool
Tool shape and behavior
- Name: Use kebab-case (e.g.
get-build-info). The qualified name seen by agents isapp.<name>. - inputSchema: Follows a JSON Schema–like shape (
type,properties,required, etc.). Agents use this to build valid arguments and understand optional vs required fields. - handler: Can be async. Return a serializable value (objects, arrays, primitives). On throw, the bridge sends an error result to the agent.
You can register multiple tools by calling useRozeniteInAppAgentTool multiple times (e.g. one call per tool) in the same or different components.
How agents see your tools
Agents discover app tools like any other domain:
The app domain is created when at least one in-app tool is registered. When all such tools are unregistered (e.g. components unmount), the domain may no longer appear.
Optional: enable/disable
You can gate registration with the enabled option:
When enabled is false, the tool is not registered and will not appear under the app domain.
Next steps
- Making your plugin agent-enabled – expose tools from your Rozenite plugin to agents.
- Go back to the Rozenite for Agents overview.
