{"record":{"id":"d5b4b79029893b8d","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-d5b4b7","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/alloydbwaitforoperation/alloydbwaitforoperation.go","lineNumber":194,"sourceCode":"\t// Polling configuration\n\tDelay      time.Duration\n\tMaxDelay   time.Duration\n\tMultiplier float64\n\tMaxRetries int\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 {\n\t\treturn nil, util.NewAgentError(\"missing 'project' parameter\", nil)\n\t}\n\tlocation, ok := paramsMap[\"location\"].(string)\n\tif !ok {","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/alloydb/alloydbwaitforoperation/alloydbwaitforoperation.go#L176-L212","documentation":"ValidateSource() type-asserts the provided sources.Source to the tool's compatibleSource interface. AlloyDB wait-for-operation only works with sources implementing its required methods (long-running operation polling against AlloyDB Admin API); any other source type fails validation with this message naming the tool type and configured source name.","triggerScenarios":"Attaching the alloydb-wait-for-operation tool to a source that does not implement compatibleSource — e.g. a postgres, cloud-sql, or storage source — either in YAML by pointing the tool's source field at an incompatible source, or programmatically by passing a wrong Source to ValidateSource.","commonSituations":"Copy-pasting a tool block between prebuilt configs and leaving the source pointing at the wrong database; renaming sources so the tool binds to the wrong one; mixing AlloyDB Admin tools with plain Postgres sources.","solutions":["Set the tool's source field to an AlloyDB (alloydb-admin style) source that implements the required interface.","Check the source definition in the sources: section of your config and confirm its type matches what this tool expects.","If you meant a different database, use the equivalent wait-for-operation tool for that source instead."],"exampleFix":"// before\nsources:\n  my-alloydb:\n    kind: postgres\ntools:\n  wait-op:\n    kind: alloydb-wait-for-operation\n    source: my-alloydb\n// after\nsources:\n  my-alloydb:\n    kind: alloydb-admin\ntools:\n  wait-op:\n    kind: alloydb-wait-for-operation\n    source: my-alloydb","handlingStrategy":"type-guard","validationCode":"if _, ok := src.(sources.Source); !ok {\n    return errors.New(\"value does not implement sources.Source\")\n}\n// before attaching the tool, check the source kind in your config matches alloydb","typeGuard":"cs, ok := src.(alloydbwaitforoperation.CompatibleSource)\nif !ok {\n    return fmt.Errorf(\"source %T is not compatible with alloydb-wait-for-operation\", src)\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n    log.Fatalf(\"tool/source mismatch: %v\", err)\n}","preventionTips":["Keep tool-to-source bindings explicit and verified in your tools.yaml.","Call ValidateSource at startup and fail fast before serving traffic.","Avoid renaming sources without updating all tool references.","Use integration tests that initialize every configured tool against its source."],"tags":["configuration","type-mismatch","alloydb","source-validation"],"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"}