CherryHQ/cherry-studio · error · McpError

MethodNotFound

MethodNotFound

Error message

Tool ${name} not found

What it means

The python MCP server only registers one tool, `python_execute`. The CallTool handler explicitly checks `if (name !== 'python_execute')` and throws McpError MethodNotFound for anything else. Unlike the memory server there is no switch; it is a single-tool server.

Source

Thrown at src/main/ai/mcp/servers/python.ts:86

                timeout: {
                  type: 'number',
                  description: 'Timeout in milliseconds (default: 60000)',
                  default: 60000
                }
              },
              required: ['code']
            }
          }
        ]
      }
    })

    // Handle tool calls
    this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params

      if (name !== 'python_execute') {
        throw new McpError(ErrorCode.MethodNotFound, `Tool ${name} not found`)
      }

      try {
        const parsed = PythonExecuteArgsSchema.safeParse(args)
        if (!parsed.success) {
          throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for python_execute: ${parsed.error.message}`)
        }

        const { code, context } = parsed.data
        // Clamp timeout to a sane range to prevent runaway or pointless executions.
        const timeout = Math.min(Math.max(parsed.data.timeout, MIN_TIMEOUT_MS), MAX_TIMEOUT_MS)

        logger.debug('Executing Python code via Pyodide')

        const result = await application.get('PythonService').executeScript(code, context, timeout)

        return {
          content: [

View on GitHub (pinned to 726446b54c)

Solutions

  1. Call `tools/list` and confirm only `python_execute` is exposed before invoking.
  2. Verify the call is routed to the python server, not another MCP server.
  3. Fix typos in the tool name at the call site.

Example fix

// before
{ name: "python_run" }
// after
{ name: "python_execute" }
Defensive patterns

Strategy: validation

Validate before calling

const PYTHON_TOOL_NAME = 'python_execute'
function assertPythonTool(name: string) {
  if (name !== PYTHON_TOOL_NAME) {
    throw new Error(`Unknown python tool: ${name}. Only 'python_execute' is supported.`)
  }
}

Type guard

const isPythonTool = (name: string): boolean => name === 'python_execute'

Try / catch

try {
  assertPythonTool(name)
  await client.callTool({ name, arguments })
} catch (e) {
  if (e instanceof McpError && e.code === ErrorCode.MethodNotFound) {
    // this server is single-tool; refresh tools/list and confirm routing
  }
  throw e
}

Prevention

When it happens

Trigger: Calling any tool name other than `python_execute` against this server — a typo, a deprecated name, or a call routed to the wrong server.

Common situations: Client/server version skew; a caller assumes the server exposes `run`, `exec`, or `eval`; the model hallucinates a tool name.

Related errors


AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12). Data as JSON: /api/errors/271bd414735c17e7. Report an issue: GitHub.