Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Tools & MCP agents

Beyond classic run(ctx) agents, the SDKs support tool agents: the model can call local tools you register in code, or MCP tools from an HTTP MCP server. You define tools and instructions; the SDK runs the agent until it returns a final answer.

Available in the JavaScript, Python, and Dart SDKs. Prefer transport: "http" for standalone runAgent / tool agents.

Two agent styles

Style
How you define it
How it runs

Classic

defineAgent({ name, run })

Your run(ctx) calls ctx.sendAI, ctx.search, etc.

Tool agent

defineAgent({ name, tools, instructions }) (no custom run required)

The SDK calls tools as needed until a final message

Classic agents keep working unchanged. When you pass tools and omit a custom run, the SDK provides the tool-agent behavior automatically.

Core APIs

API
Purpose

notifier.tools.register({ name, description, inputSchema, execute })

Register a local tool

await notifier.mcp.connect({ id, name, endpoint, transport? })

Connect an MCP HTTP server and discover tools

defineAgent({ name, tools, instructions, permissions?, observability?, middleware? })

Build a tool agent

await notifier.runAgent(agent, { input, maxToolRounds? })

Run a tool agent outside a workflow

ctx.runAgent("name")

Run a registered agent inside a workflow (tool agents work here too)

How a tool agent runs

  runAgent(agent, { input })
         │
         â–¼
  Model may request tools
         │
         â–¼
  SDK runs local / MCP tools
         │
         â–¼
  Continues until a final answer
         │
         â–¼
  { output, executionId, finishReason }

Use maxToolRounds to cap how many tool rounds a single run may take. When permission enforcement is enabled, each tool call is checked before it runs.

Local tools vs MCP

Local
MCP

Register

notifier.tools.register

notifier.mcp.connect then connection.tools()

execute

Your function

Handled by the connected MCP server

Tool name

Your name

Prefixed with the MCP server id (for example mermaid.verify)

Use case

App logic, DB, APIs you own

Public or private MCP servers

Permissions & events

Constructor options:

Option
Values
Default
Description

permissionEnforcement / permission_enforcement

"backend" | "disabled"

"backend"

Check permissions before each tool runs

onAgentEvent / on_agent_event

callback

—

Optional local events (tool.started, mcp.connected, …)

On the agent: permissions: { "tool.name": ["execute"], ... } declares which tools the agent may use.

Observability

Set observability: true on the agent (or on runAgent) to record the run in the workflow dashboard, including AI and tool steps.

Language guides

Language
Guide

JavaScript / TypeScript

Dart / Flutter

Python

Examples

Example
Description

Register a calculator tool and run it with runAgent

Connect a public MCP server and run a diagram assistant

Next steps

Last updated