{"record":{"id":"9096d5ee3a9caea0","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-9096d5","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/firestorelistcollections/firestorelistcollections.go","lineNumber":104,"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\n\t// Check if parentPath is provided\n\tparentPath, _ := mapParams[parentPathKey].(string)\n\tif parentPath != \"\" {\n\t\t// Validate parent document path\n\t\tif err := fsUtil.ValidateDocumentPath(parentPath); err != nil {\n\t\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"invalid parent document path: %v\", err), err)\n\t\t}","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/firestore/firestorelistcollections/firestorelistcollections.go#L86-L122","documentation":"firestore-list-collections' ValidateSource asserts the provided sources.Source implements compatibleSource. A source of any other type (non-Firestore) fails the check and returns this error instead of proceeding to Invoke.","triggerScenarios":"Calling ValidateSource or Invoke with a sources.Source whose concrete Go type is not the Firestore source.","commonSituations":"Config pointing the tool at a SQL/other source; programmatic misuse passing the wrong source object.","solutions":["Wire the tool to a firestore-kind source via the `source:` field.","Verify the source's `kind: firestore` in the config and that it initialized without error."],"exampleFix":"// before\n  list_collections:\n    kind: firestore-list-collections\n    source: my-mysql\n// after\n  list_collections:\n    kind: firestore-list-collections\n    source: my-firestore","handlingStrategy":"type-guard","validationCode":"if err := listCollTool.ValidateSource(src); err != nil {\n\treturn fmt.Errorf(\"firestore-list-collections requires a firestore source: %w\", err)\n}","typeGuard":"func isFirestore(s sources.Source) bool {\n\t_, ok := s.(firestore.CompatibleSource)\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\tlog.Printf(\"incompatible source: %v\", err)\n\treturn err\n}","preventionTips":["Keep firestore tools under a source whose kind is firestore.","Add a startup assertion per tool that ValidateSource passes.","Re-run config validation after any source kind change."],"tags":["firestore","source-validation","config"],"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"}