{"record":{"id":"e606128add13cf09","repo":"googleapis/mcp-toolbox","slug":"internal-error-e60612","errorCode":"INTERNAL_ERROR","errorMessage":"tool does not exist: %s","messagePattern":"tool does not exist: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/server/mcp/v20250326/manifests.go","lineNumber":106,"sourceCode":"\t\t}\n\t\tif len(authParamList) > 0 {\n\t\t\tauthParam[name] = authParamList\n\t\t}\n\t}\n\treturn InputSchema{\n\t\tType:       \"object\",\n\t\tProperties: properties,\n\t\tRequired:   required,\n\t}, authParam\n}\n\n// GenerateListToolsResult generates tools/list method result according to mcp schema\nfunc GenerateListToolsResult(pMgr *primitives.PrimitiveManager, g group.Group, urlParams map[string]string) (ListToolsResult, error) {\n\tmcpManifest := make([]Tool, 0, len(g.ToolNames))\n\tfor _, toolName := range g.ToolNames {\n\t\ttool, ok := pMgr.GetTool(toolName)\n\t\tif !ok {\n\t\t\treturn ListToolsResult{}, fmt.Errorf(\"tool does not exist: %s\", toolName)\n\t\t}\n\t\t// Skip a Tool that requires secure params as they are not supported in this protocol version.\n\t\tif tool.HasSecureParams() {\n\t\t\tcontinue\n\t\t}\n\t\tsrcName := tool.GetSourceName()\n\t\tvar src sources.Source\n\t\tif srcName != \"\" {\n\t\t\tsrc, ok = pMgr.GetSource(srcName)\n\t\t\tif !ok {\n\t\t\t\treturn ListToolsResult{}, fmt.Errorf(\"unable to retrieve %s source for tool %q\", srcName, tool.GetName())\n\t\t\t}\n\t\t}\n\t\tparams, err := tool.GetParameters(src)\n\t\tif err != nil {\n\t\t\treturn ListToolsResult{}, fmt.Errorf(\"error getting parameters for tool %q: %w\", toolName, err)\n\t\t}\n\t\ttoolManifest := generateToolManifest(toolName, tool.GetDescription(), tool.GetAuthRequired(), params, tool.GetAnnotations(src), urlParams)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/mcp/v20250326/manifests.go#L88-L124","documentation":"GenerateListToolsResult builds the tools/list response for the MCP 2025-03-26 protocol by iterating over the tool names registered in a group and looking each one up in the PrimitiveManager. This INTERNAL_ERROR is thrown when a group lists a tool name that the manager cannot resolve, meaning server-side registration state is inconsistent rather than a client mistake.","triggerScenarios":"A group.Group's ToolNames slice contains a name that was never registered (or was removed) from primitives.PrimitiveManager, so pMgr.GetTool(toolName) returns ok=false while generating the tools/list manifest.","commonSituations":"Custom group construction that hardcodes tool names with typos; tools registered after groups were built; code that removes/unregisters a tool without rebuilding groups; server misconfiguration where a toolset references a tool from a disabled source.","solutions":["Ensure every tool name added to group.ToolNames is registered via PrimitiveManager before serving requests","Rebuild groups whenever tools are added or removed so group and manager stay in sync","Check server startup logs and config for misspelled or duplicate tool names","File a bug if this occurs with stock server code, since it indicates internal state corruption"],"exampleFix":"// before (group built from stale names)\ng.ToolNames = []string{\"execute_sql\", \"list_tables\"}\n// after (derive names from registered tools)\nfor name := range registeredTools { g.ToolNames = append(g.ToolNames, name) }","handlingStrategy":"validation","validationCode":"tool, ok := pMgr.GetTool(name)\nif !ok {\n    return fmt.Errorf(\"tool %q is not registered; check group registration\", name)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive group tool names from the registry, never hardcode them","Add a startup assertion that every group tool resolves in PrimitiveManager","Rebuild groups inside the same lock/scope as tool registration changes"],"tags":["go","mcp","internal-state","tool-registry"],"backgroundTag":"tool-not-registered","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}