{"record":{"id":"2a1093ae1e2966c0","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-2a1093","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/alloydb/alloydblistinstances/alloydblistinstances.go","lineNumber":101,"sourceCode":"}\n\n// Tool represents the list-instances 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// Invoke executes the tool's logic.\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\tparamsMap := params.AsMap()\n\n\tproject, ok := paramsMap[\"project\"].(string)\n\tif !ok || project == \"\" {\n\t\treturn nil, util.NewAgentError(\"invalid or missing 'project' parameter; expected a string\", nil)\n\t}\n\tlocation, ok := paramsMap[\"location\"].(string)\n\tif !ok {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/alloydb/alloydblistinstances/alloydblistinstances.go#L83-L119","documentation":"ValidateSource for alloydb-list-instances verifies the attached source implements compatibleSource (GetDefaultProject, UseClientAuthorization, ListInstance). Failing that, the tool cannot operate against the AlloyDB Admin API and this error is returned. It surfaces at tool/source wiring validation time.","triggerScenarios":"ValidateSource called with any sources.Source other than the alloydb source — e.g. tools.yaml binds this tool to a postgres, mysql, or http source.","commonSituations":"Incorrect source reference in tools.yaml; copying tool definitions between source sections; refactoring source names without updating tool bindings.","solutions":["Set the tool's 'source' to an alloydb source name","Confirm the source kind in the sources section of tools.yaml is alloydb","Fix and re-validate the config before starting the server"],"exampleFix":"// before\nsource: my-bigquery\n// after\nsource: my-alloydb","handlingStrategy":"validation","validationCode":"if _, ok := source.(interface {\n    GetDefaultProject() string\n    UseClientAuthorization() bool\n    ListInstance(context.Context, string, string, string) (any, error)\n}); !ok {\n    return fmt.Errorf(\"source %T incompatible with alloydb-list-instances\", source)\n}","typeGuard":"func isAlloyDBInstanceSource(s sources.Source) bool {\n    _, ok := s.(alloydblistinstances.CompatibleSource)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Verify the source kind is alloydb in tools.yaml","Run config validation before server start","Avoid copy-pasting tool blocks across source kinds"],"tags":["alloydb","configuration","type-mismatch","gcp"],"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"}