{"record":{"id":"1115794fddf7d13c","repo":"googleapis/mcp-toolbox","slug":"unable-to-retrieve-s-source-for-tool-q-111579","errorCode":null,"errorMessage":"unable to retrieve %s source for tool %q","messagePattern":"unable to retrieve (.+?) source for tool %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/server/mcp/v20260728/manifests.go","lineNumber":129,"sourceCode":"\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, supportsSecureParams bool) (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\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\n\t\t// Skip a Tool that requires secure params extension if the client doesn't support it.\n\t\tif tool.HasSecureParams() && !supportsSecureParams {\n\t\t\tcontinue\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\tres := ListToolsResult{\n\t\tTools: mcpManifest,\n\t\tResult: Result{\n\t\t\tResultType: resultTypeComplete,","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/mcp/v20260728/manifests.go#L111-L147","documentation":"GenerateListToolsResult fetches each tool's backing source via pMgr.GetSource(tool.GetSourceName()) so tool parameters can be generated. If the source name is registered on the tool but no such source exists in the manager, it returns \"unable to retrieve %s source for tool %q\". The tool→source wiring in the config is broken.","triggerScenarios":"A tool's `source:` field names a source that is not defined (or failed to initialize) in the `sources:` section of the config, so GetSource(srcName) returns !ok while building the tools/list manifest.","commonSituations":"Typo in the tool's `source` value, source block deleted or renamed while tools still reference it, source failing at startup due to missing credentials/env vars causing it not to register, or copying a tool entry between configs without its source.","solutions":["Check that a source with exactly that name exists under `sources:` in the YAML config.","Look at startup logs for source initialization failures (bad DSN, missing env vars) that prevented registration.","Fix the tool's `source:` field to reference the correct source name.","Validate the full config loads cleanly before serving (run the server and confirm no config errors at startup)."],"exampleFix":"// before\ntools:\n  execute_sql:\n    kind: postgres-execute-sql\n    source: mydb   # no such source\n// after\nsources:\n  my-pg:\n    kind: postgres\n    uri: ${POSTGRES_URI}\ntools:\n  execute_sql:\n    kind: postgres-execute-sql\n    source: my-pg\n","handlingStrategy":"validation","validationCode":"// Config sanity check before serving (server side):\nfor (const [name, tool] of Object.entries(config.tools)) {\n  if (!(tool.source in (config.sources ?? {}))) {\n    throw new Error(`tool ${name} references missing source ${tool.source}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const {tools} = await client.request({method:'tools/list'});\n} catch (e) {\n  if (String(e.message).includes('unable to retrieve') && String(e.message).includes('source for tool')) {\n    console.error('Tool references a missing source; fix the sources: block:', e.message);\n  } else throw e;\n}","preventionTips":["Define every source referenced by a tool in the sources: block, with matching names.","Confirm sources initialize successfully at startup (valid DSNs, credentials set).","Copy source blocks together with tool entries when moving config between files.","Lint the config so tool.source values must resolve to a declared source."],"tags":["mcp","source-not-found","manifest","config"],"backgroundTag":"missing-source-reference","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"}