moeru-ai/airi · warning

[builtIn_mcpListTools] failed to list tools:

Error message

[builtIn_mcpListTools] failed to list tools:

What it means

The LLM-callable tool builtIn_mcpListTools failed to enumerate MCP tools because runtime.listTools() rejected (transport down, server not configured, or connect timeout). The tool logs the failure and returns an empty string to the model instead of throwing, so the model sees an empty tool list and subsequent builtIn_mcpCallTool calls have no names to work with.

Source

Thrown at packages/stage-ui/src/tools/mcp.ts:103

 * - A runtime wants to register MCP tools into the shared LLM tool store
 *
 * Expects:
 * - The runtime implements the `McpToolRuntime` contract
 *
 * Returns:
 * - xsai tool definition promises for MCP listing and invocation
 */
export function createMcpTools(runtime: McpToolRuntime): Array<Promise<Tool>> {
  return [
    tool({
      name: 'builtIn_mcpListTools',
      description: 'List all available MCP tools. Call this first to discover tool names before calling builtIn_mcpCallTool.',
      execute: async () => {
        try {
          return await runtime.listTools()
        }
        catch (error) {
          console.warn('[builtIn_mcpListTools] failed to list tools:', error)
          return ''
        }
      },
      parameters: z.object({}).strict(),
    }),
    tool({
      name: 'builtIn_mcpCallTool',
      description: 'Call an MCP tool by name. Use builtIn_mcpListTools first to get available tool names.',
      execute: async ({ name, arguments: argsJson }) => {
        try {
          const args = argsJson ? JSON.parse(argsJson) : {}
          return await runtime.callTool({ name, arguments: args })
        }
        catch (error) {
          return {
            isError: true,
            content: [{ type: 'text', text: errorMessageFromValue(error) }],
          }

View on GitHub (pinned to 677329427f)

Solutions

  1. Verify MCP servers are configured and running in settings; test the connection there first
  2. Check the transport type/URL matches the server (stdio vs streamable HTTP vs SSE)
  3. Return a diagnostic string instead of '' so the model can report the failure to the user
  4. Increase the MCP connect timeout or connect eagerly before the model invokes the tool

Example fix

// before
catch (error) {
  console.warn('[builtIn_mcpListTools] failed to list tools:', error)
  return ''
}

// after: give the model something actionable
catch (error) {
  console.warn('[builtIn_mcpListTools] failed to list tools:', error)
  return `MCP tool listing failed: ${errorMessageFrom(error) ?? 'unknown'}`
}
Defensive patterns

Strategy: fallback

Try / catch

execute: async () => {
  try {
    return await runtime.listTools()
  }
  catch (error) {
    console.warn('[builtIn_mcpListTools] failed to list tools:', error)
    return '' // model sees an empty list; prefer returning a short diagnostic string
  }
}

Prevention

When it happens

Trigger: runtime.listTools() rejecting: MCP server not running, wrong transport URL, connect timeout, or no servers configured; runtime transport not initialized before the model calls the tool.

Common situations: MCP server not configured or its process not started; wrong transport type chosen in settings; slow local MCP server exceeding the connect timeout.

Related errors


AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18). Data as JSON: /api/errors/207c9ad0eba65c64. Report an issue: GitHub.