{"record":{"id":"24ca8db4c00b5f4a","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-24ca8d","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/firestorequery/firestorequery.go","lineNumber":128,"sourceCode":"var _ tools.Tool = Tool{}\n\n// Tool represents the Firestore query tool\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\n// OrderByConfig represents ordering configuration\ntype OrderByConfig struct {\n\tField     string `json:\"field\"`\n\tDirection string `json:\"direction\"`\n}\n\n// GetDirection returns the Firestore direction constant\nfunc (o *OrderByConfig) GetDirection() firestoreapi.Direction {\n\tif strings.EqualFold(o.Direction, \"DESCENDING\") || strings.EqualFold(o.Direction, \"DESC\") {\n\t\treturn firestoreapi.Desc\n\t}\n\treturn firestoreapi.Asc\n}\n","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/firestore/firestorequery/firestorequery.go#L110-L146","documentation":"Source-compatibility check in ValidateSource: the configured source does not implement the Firestore compatibleSource interface, so the query tool is bound to a source that cannot run Firestore queries.","triggerScenarios":"Resolving or invoking the tool with a source whose concrete type does not satisfy compatibleSource.","commonSituations":"Tool bound to the wrong source name in YAML; swapping source kinds in shared configs without updating tool bindings.","solutions":["Point the tool's `source:` at a firestore-kind source.","Check that the referenced source definition exists and has `kind: firestore`.","Pass the correct *firestore.Source when validating programmatically."],"exampleFix":"// before\n  query:\n    kind: firestore-query\n    source: my-postgres\n// after\n  query:\n    kind: firestore-query\n    source: my-firestore","handlingStrategy":"type-guard","validationCode":"if err := queryTool.ValidateSource(src); err != nil {\n\treturn fmt.Errorf(\"firestore-query bound to non-firestore source: %w\", err)\n}","typeGuard":"func isCompatibleFirestoreSource(s sources.Source) bool {\n\t_, ok := s.(firestore.CompatibleSource)\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\treturn fmt.Errorf(\"cannot invoke query tool: %w\", err)\n}","preventionTips":["Verify each tool's `source:` points to a source with kind firestore.","Run a smoke test that initializes every tool/source pair at boot.","Avoid sharing a single tool definition across different engine sources."],"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"}