{"record":{"id":"1ed8b4314a212003","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-1ed8b4","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/firestoremongodb/firestoremongodbexecutemql/firestoremongodbexecutemql.go","lineNumber":102,"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\tquery, ok := mapParams[queryKey].(string)\n\tif !ok || query == \"\" {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"parameter %q is required and must be a non-empty string\", queryKey), nil)\n\t}\n\n\tlogger, err := util.LoggerFromContext(ctx)\n\tif err != nil {","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/firestoremongodb/firestoremongodbexecutemql/firestoremongodbexecutemql.go#L84-L120","documentation":"firestore-mongodb-execute-mql tools can only run against sources implementing the compatibleSource interface (FirestoreClient() and ExecuteMQL). During server startup, Toolbox calls ValidateSource with the source named in the tool's config; if that source's Go type doesn't implement the interface, this error is returned and the tool fails to load.","triggerScenarios":"A tool of type \"firestore-mongodb-execute-mql\" in tools.yaml references a \"source\" field pointing at a source that is not a Firestore MongoDB compatible source (e.g., a postgres, http, or plain firestore source), so the type assertion source.(compatibleSource) fails.","commonSituations":"Copy-pasting a tool block between tool configs and forgetting to update the source name; pointing several tools at one source name that was later redefined to a different kind; typos in the source name that silently resolve to a differently-typed source.","solutions":["Set the tool's \"source\" field in tools.yaml to a source declared as kind \"firestore-mongodb\".","Check the sources: section of tools.yaml and confirm the named source's kind matches the tool type.","If the tool should target a different backend, change the tool \"type\" to one matching the existing source instead."],"exampleFix":"# before\ntools:\n  run-query:\n    type: firestore-mongodb-execute-mql\n    source: my-postgres-src\n    description: Run MQL\n# after\ntools:\n  run-query:\n    type: firestore-mongodb-execute-mql\n    source: my-firestore-mongodb-src\n    description: Run MQL","handlingStrategy":"validation","validationCode":"// Before starting the toolbox, check tool/source pairing in tools.yaml\nfor _, tool := range cfg.Tools {\n    if tool.Type == \"firestore-mongodb-execute-mql\" {\n        src, ok := cfg.Sources[tool.Source]\n        if !ok || src.Kind != \"firestore-mongodb\" {\n            return fmt.Errorf(\"tool %q requires a firestore-mongodb source, got %q\", tool.Name, tool.Source)\n        }\n    }\n}","typeGuard":"func isFirestoreMongoDBSource(s sources.Source) bool {\n    _, ok := s.(interface {\n        FirestoreClient() *firestore.Client\n        ExecuteMQL(context.Context, string) (any, error)\n    })\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Keep tool \"source\" names pointing only at sources of the matching kind in tools.yaml","Review the tool's docs page for its required source kind before wiring it","Name sources to include their kind (e.g., firestore-mongodb-prod) to avoid mixups"],"tags":["go","config","source-compatibility"],"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"}