{"record":{"id":"87ee3f28f98f0c9a","repo":"googleapis/mcp-toolbox","slug":"unable-to-retrieve-s-source-for-tool-q-87ee3f","errorCode":null,"errorMessage":"unable to retrieve %s source for tool %q","messagePattern":"unable to retrieve (.+?) source for tool %q","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/server/mcp/v20241105/manifests.go","lineNumber":118,"sourceCode":"\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)\n\t\tmcpManifest = append(mcpManifest, toolManifest)\n\t}\n\treturn ListToolsResult{Tools: mcpManifest}, nil\n}\n\n// generatePromptManifest generates a version-specific Prompt manifest for list/prompts\nfunc generatePromptManifest(name, desc string, args prompts.Arguments) Prompt {\n\tmcpArgs := make([]PromptArgument, 0, len(args))\n\tfor _, arg := range args {\n\t\tpromptArg := PromptArgument{\n\t\t\tName:        arg.GetName(),","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/mcp/v20241105/manifests.go#L100-L136","documentation":"While building the tools/list manifest, GenerateListToolsResult resolves each tool's backing source via pMgr.GetSource(srcName). If the source the tool depends on is not registered, it returns \"unable to retrieve <src> source for tool <tool>\". The tool exists, but its data-source dependency is missing from the manager.","triggerScenarios":"A tool declares source: my-db but no source named my-db is defined/initialized in the config; the source's Initialize failed (bad credentials, missing env var) so it never registered; source renamed while the tool's source reference was not updated.","commonSituations":"Missing or wrong environment variables (connection strings, keys) so the source fails at startup; copy-pasting tool definitions without their source block; source kind typos (e.g. postgres vs alloydb-pg) so it is not registered; edited configs where the source section was deleted.","solutions":["Verify the source block with that exact name exists and its kind is correct in your tools config.","Check server startup logs for source initialization errors (bad credentials/env) and fix the environment so the source registers.","Confirm the tool's source reference spelling matches the source's name field exactly.","Restart the server with the corrected config and re-run tools/list."],"exampleFix":"# before: tool references a source that fails to init\ntools:\n  run-query:\n    source: prod-db\n# environment missing PROD_DB_URI -> source never registers\n# after: export the required env so the source initializes\nexport PROD_DB_URI=postgres://...  # then restart toolbox","handlingStrategy":"validation","validationCode":"// Pre-flight: confirm every tool's source exists in the source list\nconst sources = new Set((await (await fetch(`${base}/api/source`)).json()).map(s => s.name));\nfor (const tool of tools) {\n  if (tool.source && !sources.has(tool.source)) throw new Error(`Missing source ${tool.source} for ${tool.name}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify required env vars for each source are set before starting the server","Check startup logs for source initialization errors before pointing clients at the server","Ensure every tool's `source:` field matches a defined source name exactly"],"tags":["mcp","tools-list","source","configuration","dependency-resolution"],"backgroundTag":"missing-data-source","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"}