List tools
client.tools.list() returns every tool available to your application. Each tool has an id, name, optional description, and optional inputSchema describing its parameters.
- Gateway-routed tools keep the ID returned by the gateway.
- Direct internal integration tools are normalized as
<integrationId>:<toolName>. - Single-endpoint mode usually uses the MCP server’s tool names.
tools.list().
The limit option caps the gateway discovery query. It only applies in gateway mode; in other modes the parameter is ignored and all tools are returned.
Execute a tool
client.tools.execute(toolId, args) runs a tool and returns a ToolResult with a content string and the raw MCP response.
Full example
Check integrations
client.integrations.list() returns the status of every integration attached to your application. Each entry tells you whether the user has connected that integration.
Handle disconnected integrations
Whenconnected is false, the IntegrationInfo object may include a connectUrl you can open so the user can complete connection steps. This can be OAuth authorization or API key (user_token) setup. It may also include a reason explaining why the integration is not connected.
onIntegrationRequired callback, which fires when a tool call fails because the integration is not connected:
Tool shape reference
Next steps
- Authentication — OAuth sign-in, callbacks, and session management.
- Storage — Persist tokens across sessions with custom backends.
- Client Types — Full type reference for
KontextClient,KontextTool, andToolResult.