{"record":{"id":"43769af9fb2b5922","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-43769a","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/cloudhealthcare/cloudhealthcareretrieverendereddicominstance/cloudhealthcareretrieverendereddicominstance.go","lineNumber":106,"sourceCode":"// validate interface\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\tstoreID, err := common.ValidateAndFetchStoreID(params, source.AllowedDICOMStores())\n\tif err != nil {\n\t\treturn nil, util.NewAgentError(\"failed to validate store ID\", err)\n\t}\n\tvar tokenStr string\n\tif source.UseClientAuthorization() {\n\t\ttokenStr, err = accessToken.ParseBearerToken()\n\t\tif err != nil {\n\t\t\treturn nil, util.NewClientServerError(\"error parsing access token\", http.StatusUnauthorized, err)","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudhealthcare/cloudhealthcareretrieverendereddicominstance/cloudhealthcareretrieverendereddicominstance.go#L88-L124","documentation":"ValidateSource on the cloudhealthcare-retrieve-rendered-dicom-instance tool asserts that the provided source implements the tool's compatibleSource interface. Any source that is not a Cloud Healthcare source fails the assertion and produces this error. It is the tool's way of rejecting misconfigured source bindings before Invoke runs.","triggerScenarios":"Any call path that runs ValidateSource (typically during server startup/initialization) with a source other than an internal/sources/cloudhealthcare Source bound to this tool.","commonSituations":"tools.yaml binding the tool to a wrong-kind source (e.g. a Cloud SQL or postgres source); refactoring that renamed the healthcare source so another source is picked up; using a copied config where the source kind was changed but the tool reference wasn't.","solutions":["Point the tool's source at a source of kind cloudhealthcare in tools.yaml","Run the server startup and read the ValidateSource failure to identify which source name is wrong","Confirm the referenced source initializes to *cloudhealthcare.Source (implements UseClientAuthorization/AllowedDICOMStores)"],"exampleFix":"// before (tools.yaml)\nsource: cloudsql-postgres-prod\n// after\nsource: healthcare-fhir-dicom-store","handlingStrategy":"type-guard","validationCode":"// in tools.yaml, ensure kinds line up:\n// tool kind: cloudhealthcare-retrieve-rendered-dicom-instance\n// source kind: cloudhealthcare","typeGuard":"func isHealthcareSource(s sources.Source) bool {\n\t_, ok := s.(cloudhealthcare.Source)\n\treturn ok\n}","tryCatchPattern":"if err := tool.ValidateSource(src); err != nil {\n\tif strings.Contains(err.Error(), \"not a compatible type\") {\n\t\tlog.Fatalf(\"tool %s must bind a cloudhealthcare source\", tool.GetName())\n\t}\n\treturn err\n}","preventionTips":["Check source kind matches tool family before referencing it","Avoid renaming sources that tools depend on without updating tool configs","Run integration config validation locally before merge"],"tags":["go","cloud-healthcare","source-compatibility","config"],"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"}