Interface: ChatMCPOptions#
Defined in: packages/ai/src/activities/chat/mcp/types.ts:55
Options controlling MCP tool discovery and lifecycle for a chat() call.
Properties#
clients#
clients: MCPToolSource[];
Defined in: packages/ai/src/activities/chat/mcp/types.ts:59
The MCP clients or client pools to discover tools from and manage.
connection?#
optional connection: MCPConnectionPolicy;
Defined in: packages/ai/src/activities/chat/mcp/types.ts:66
Connection lifecycle policy applied to all clients when the run ends.
Defaults to 'close'.
lazyTools?#
optional lazyTools: boolean;
Defined in: packages/ai/src/activities/chat/mcp/types.ts:74
When true, tool schemas are fetched lazily (forwarded to
tools({ lazy: true })).
Defaults to false.
onDiscoveryError()?#
optional onDiscoveryError: (error, source) => void | Promise<void>;
Defined in: packages/ai/src/activities/chat/mcp/types.ts:85
Called when tool discovery fails for a single source.
- Throw (or re-throw) from this handler to fail the entire chat call fast.
- Return normally to skip that source and continue with remaining clients.
- Omit this handler entirely to rethrow the error (fail-fast by default).
Async handlers are awaited, so a rejected promise also fails fast.
Parameters#
error#
unknown
source#
Returns#
void | Promise<void>