{"record":{"id":"f21797282dfc757f","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-f21797","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/cloudstoragegetbucketmetadata/cloudstoragegetbucketmetadata.go","lineNumber":107,"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 := cloudstoragecommon.ResolveString(t.Cfg.Bucket, mapParams, bucketKey)\n\tif 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\tattrs, err := source.GetBucketMetadata(ctx, bucket)\n\tif err != nil {\n\t\treturn nil, cloudstoragecommon.ProcessGCSError(err)","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudstorage/cloudstoragegetbucketmetadata/cloudstoragegetbucketmetadata.go#L89-L125","documentation":"cloudstorage-get-bucket-metadata's ValidateSource rejects any source not implementing its compatibleSource interface. The tool can only be bound to a Cloud Storage source; binding it to any other source type fails at startup with this message naming the tool and configured source.","triggerScenarios":"Tool config `source` references a source whose Go type fails the `source.(compatibleSource)` type assertion during ValidateSource.","commonSituations":"Tool defined under the wrong source in YAML; refactoring source names; reusing a generic tools.yaml across projects with different sources.","solutions":["Bind the tool to a cloudstorage source (the `source:` value must match a cloudstorage entry in `sources:`).","Delete or move the tool to the correct source's toolset.","Verify source key spelling in the YAML."],"exampleFix":"# before\nsource: alloydb-source\n# after\nsource: gcs-source","handlingStrategy":"validation","validationCode":"if _, ok := src.(compatibleSource); !ok {\n    return fmt.Errorf(\"get-bucket-metadata requires a cloudstorage source, got %T\", src)\n}","typeGuard":"func isCompatible(s sources.Source) bool { _, ok := s.(compatibleSource); return ok }","tryCatchPattern":null,"preventionTips":["Match each tool kind to its source kind in config review","Rename sources with search-and-replace across the whole config","Run toolbox startup validation in CI"],"tags":["go","cloudstorage","source-type-mismatch"],"backgroundTag":"source-type-mismatch","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"}