{"record":{"id":"7a46c6220fc98d90","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-7a46c6","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/cloudstoragemoveobject/cloudstoragemoveobject.go","lineNumber":113,"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\tsourceObject, ok := mapParams[sourceObjectKey].(string)\n\tif !ok || sourceObject == \"\" {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"invalid or missing '%s' parameter; expected a non-empty string\", sourceObjectKey), nil)\n\t}","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudstorage/cloudstoragemoveobject/cloudstoragemoveobject.go#L95-L131","documentation":"Thrown by cloudstorage-move-object ValidateSource when the provided sources.Source does not satisfy the tool's compatibleSource interface. Only Cloud Storage sources can back this tool; any other source kind fails the type assertion.","triggerScenarios":"Tool config references a non-cloud-storage source via `source:`; ValidateSource called programmatically with an incompatible source implementation.","commonSituations":"Misconfigured source reference after copying another tool's YAML; refactoring source names and leaving the tool pointed at a database source.","solutions":["Set the tool's `source` to a cloud-storage kind source","Confirm the source name matches an entry defined under sources in tools.yaml","Reload the config and re-run to verify validation passes"],"exampleFix":"// before\n  move-object:\n    kind: cloudstorage-move-object\n    source: my-mysql\n// after\n  move-object:\n    kind: cloudstorage-move-object\n    source: my-gcs","handlingStrategy":"type-guard","validationCode":"// ensure the referenced source kind matches before binding\nif cfg.SourceKind != \"cloud-storage\" {\n    return fmt.Errorf(\"tool %s requires a cloud-storage source, got %s\", cfg.Name, cfg.SourceKind)\n}","typeGuard":"func isCompatibleSource(s sources.Source) bool {\n    _, ok := s.(interface{ GCSClient() *storage.Client });\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Keep a naming convention like gcs-* for Cloud Storage sources","After renaming sources, grep tool configs for stale references","Write a startup integration test validating every tool/source pair"],"tags":["go","configuration","type-mismatch","cloud-storage"],"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"}