{"record":{"id":"67b83eac04595be7","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-67b83e","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/alloydbcreateinstance/alloydbcreateinstance.go","lineNumber":101,"sourceCode":"}\n\n// Tool represents the create-instance 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\tproject, ok := paramsMap[\"project\"].(string)\n\tif !ok || project == \"\" {\n\t\treturn nil, util.NewAgentError(\"invalid or missing 'project' parameter; expected a non-empty string\", nil)\n\t}\n\n\tlocation, ok := paramsMap[\"location\"].(string)\n\tif !ok || location == \"\" {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/alloydb/alloydbcreateinstance/alloydbcreateinstance.go#L83-L119","documentation":"ValidateSource for alloydb-alloydbcreateinstance asserts the bound sources.Source implements compatibleSource (an AlloyDB admin source exposing UseClientAuthorization and GetDefaultProject). Any other source kind fails the assertion and yields this error, preventing the tool from running against an incompatible source.","triggerScenarios":"alloydb-alloydbcreateinstance configured with a `source` that is not the AlloyDB admin source; triggered during startup validation or before Invoke.","commonSituations":"Binding the instance-creation tool to an alloydb-postgres (SQL) source instead of the admin source; shared config templates where `source:` was not updated.","solutions":["Set the tool's `source` to a kind: alloydb admin source","Cross-check the `sources:` block to confirm the referenced kind","Re-run the toolbox and verify clean tool registration"],"exampleFix":"// before\nsource: alloydb-postgres-source\n// after\nsource: alloydb-admin-source","handlingStrategy":"validation","validationCode":"if err := tool.ValidateSource(src); err != nil {\n  log.Fatal(err)\n}","typeGuard":"func isCompatible(s sources.Source) bool {\n  _, ok := s.(compatibleSource)\n  return ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n  return fmt.Errorf(\"reconfigure tool source: %w\", err)\n}","preventionTips":["Pair admin tools only with kind: alloydb sources","Validate configs in CI before deploy"],"tags":["alloydb","tool-config","source-mismatch"],"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"}