{"record":{"id":"cb0f4b2bafb4a2b3","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-cb0f4b","errorCode":null,"errorMessage":"invalid source for %q tool: source %q is not a compatible type","messagePattern":"invalid source for %q tool: source %q is not a compatible type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/firestore/firestoreadddocuments/firestoreadddocuments.go","lineNumber":136,"sourceCode":"// validate interface\nvar _ tools.Tool = Tool{}\n\ntype Tool struct {\n\ttools.BaseTool[Config]\n}\n\nfunc (t Tool) GetSourceName() string {\n\treturn t.Cfg.Source\n}\n\nfunc (t Tool) ToConfig() tools.ToolConfig {\n\treturn t.Cfg\n}\n\nfunc (t Tool) ValidateSource(source sources.Source) error {\n\t_, ok := source.(compatibleSource)\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid source for %q tool: source %q is not a compatible type\", t.Cfg.Type, t.Cfg.Source)\n\t}\n\treturn nil\n}\n\nfunc (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {\n\tsource, ok := s.(compatibleSource)\n\tif !ok {\n\t\treturn nil, util.NewClientServerError(\"source used is not compatible with the tool\", http.StatusInternalServerError, nil)\n\t}\n\tmapParams := params.AsMap()\n\t// Get collection path\n\tcollectionPath, ok := mapParams[collectionPathKey].(string)\n\tif !ok || collectionPath == \"\" {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"invalid or missing '%s' parameter\", collectionPathKey), nil)\n\t}\n\t// Validate collection path\n\tif err := fsUtil.ValidateCollectionPath(collectionPath); err != nil {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"invalid collection path: %v\", err), err)","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/firestore/firestoreadddocuments/firestoreadddocuments.go#L118-L154","documentation":"Tool.ValidateSource for the Firestore add-documents tool fails when the injected source does not implement the Firestore compatibleSource interface. The message shows the tool type and the configured source name, indicating a source-kind mismatch.","triggerScenarios":"Config assigns a non-Firestore source (e.g., a SQL database) to a firestore-add-documents tool; or the source name resolves to an incompatible source implementation at runtime.","commonSituations":"Wiring Firestore tools to Cloud SQL or other sources by mistake; typos in source names; reusing tool templates across source kinds.","solutions":["Set 'source' to a Firestore source (kind: firestore).","Check the sources section for the correct source name/kind pairing.","Reload the server and confirm tools initialize without validation errors."],"exampleFix":"// before\nsource: my-postgres\n// after\nsource: my-firestore","handlingStrategy":"validation","validationCode":"# Verify Firestore tool binding\nsrc = cfg['sources'][tool['source']]\nassert src['kind'] == 'firestore', \"firestore-add-documents requires a firestore source\"","typeGuard":null,"tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    log.Fatalf(\"bad source for firestore tool: %v\", err)\n}","preventionTips":["Bind Firestore tools only to kind: firestore sources.","Check source name spelling in tools.yaml.","Run a config dry-run before deployment.","Keep prebuilt and custom sources in separate named entries to avoid confusion."],"tags":["firestore","config","source-mismatch"],"backgroundTag":"incompatible-source-type","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"}