{"record":{"id":"2799927b3ec83cb9","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-279992","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/cloudstorage/cloudstoragedeletebucket/cloudstoragedeletebucket.go","lineNumber":100,"sourceCode":"\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\tbucket, ok := mapParams[bucketKey].(string)\n\tif !ok || bucket == \"\" {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"invalid or missing '%s' parameter; expected a non-empty string\", bucketKey), nil)\n\t}\n\n\tresp, err := source.DeleteBucket(ctx, bucket)\n\tif err != nil {\n\t\treturn nil, cloudstoragecommon.ProcessGCSError(err)","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudstorage/cloudstoragedeletebucket/cloudstoragedeletebucket.go#L82-L118","documentation":"This error is thrown by Tool.ValidateSource when the source instance passed to the cloudstorage-delete-bucket tool does not implement the tool's compatibleSource interface. The toolbox only allows tools to run against sources that provide the required client (e.g. a Cloud Storage-backed source with storage client). It fails fast at validation time instead of panicking later during Invoke.","triggerScenarios":"Registering the cloudstorage-delete-bucket tool in tools.yaml but binding it to a source of the wrong kind (e.g. a postgres, bigquery, or other non-cloudstorage source, or a cloudstorage source whose client is not the storage client the interface requires).","commonSituations":"Copy-pasting a tools.yaml where the tool's source field points at the wrong named source; renaming sources and leaving a stale reference; mixing sources from incompatible SDK versions after an upgrade.","solutions":["Set the tool's source field to the name of a cloudstorage source in tools.yaml","Verify the referenced source kind is the Cloud Storage source that implements the tool's compatibleSource interface","Run the toolbox and check startup logs: source type mismatch is reported at config load time"],"exampleFix":"// before\nsources:\n  my-db:\n    kind: postgres\n    uri: ...\ntools:\n  delete-bucket:\n    kind: cloudstorage-delete-bucket\n    source: my-db\n// after\nsources:\n  my-gcs:\n    kind: cloudstorage\n    ...\ntools:\n  delete-bucket:\n    kind: cloudstorage-delete-bucket\n    source: my-gcs","handlingStrategy":"type-guard","validationCode":"// before starting the server, check the source kind in your tools.yaml\nsources := cfg.Sources\nif _, ok := sources[\"my-gcs\"].(cloudstorage.Source); !ok {\n    log.Fatalf(\"tool delete-bucket requires a cloudstorage source\")\n}","typeGuard":"func isCompatibleGCSSource(s sources.Source) bool {\n    _, ok := s.(cloudstorage.CompatibleSource)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Always pair cloudstorage tools with a cloudstorage-kind source in tools.yaml","Run `toolbox` once locally to validate config before deploying","Keep source names descriptive (e.g. gcs-prod) to avoid mis-binding"],"tags":["go","mcp-toolbox","configuration","source-mismatch"],"backgroundTag":"incompatible-tool-source","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"}