{"record":{"id":"5ef2aae24c67140b","repo":"googleapis/mcp-toolbox","slug":"invalid-source-for-q-tool-source-q-is-not-a-com-5ef2aa","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/cloudhealthcarefhirfetchpage/cloudhealthcarefhirfetchpage.go","lineNumber":103,"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\turl, ok := params.AsMap()[pageURLKey].(string)\n\tif !ok {\n\t\treturn nil, util.NewAgentError(fmt.Sprintf(\"invalid or missing '%s' parameter; expected a string\", pageURLKey), nil)\n\t}\n\n\tvar tokenStr string\n\tvar err error\n\tif source.UseClientAuthorization() {\n\t\ttokenStr, err = accessToken.ParseBearerToken()","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudhealthcare/cloudhealthcarefhirfetchpage/cloudhealthcarefhirfetchpage.go#L85-L121","documentation":"ValidateSource checks that the source bound to the cloud-healthcare-fhir-fetch-page tool implements the tool's compatibleSource interface (a Cloud Healthcare FHIR store source). Any other source kind is rejected with this message, embedding the tool and source names from the config.","triggerScenarios":"Assigning a non-Cloud-Healthcare source (e.g. postgres, http) to a cloud-healthcare-fhir-fetch-page tool in tools.yaml.","commonSituations":"Copy-pasted tool configs across integrations; source renamed/repointed to the wrong service; assuming the fetch-page tool works with any HTTP-capable source.","solutions":["Point the tool at a cloud-healthcare source kind in tools.yaml","Verify the source name exists and is of a FHIR-compatible Cloud Healthcare type","Use the documented cloud-healthcare source as the tool's source"],"exampleFix":"// before\n  fetch-page:\n    kind: cloud-healthcare-fhir-fetch-page\n    source: pg-src\n// after\n  fetch-page:\n    kind: cloud-healthcare-fhir-fetch-page\n    source: healthcare-src","handlingStrategy":"validation","validationCode":"// reject bad pairing early\nif err := tool.ValidateSource(src); err != nil {\n\treturn fmt.Errorf(\"config error: %w\", err)\n}","typeGuard":"func requireCompatible(src sources.Source) (compatibleSource, error) {\n\tcs, ok := src.(compatibleSource)\n\tif !ok { return nil, fmt.Errorf(\"source %T is not compatible\", src) }\n\treturn cs, nil\n}","tryCatchPattern":null,"preventionTips":["Bind fetch-page tools only to Cloud Healthcare FHIR sources","Run config validation at boot/CI"],"tags":["config","source-validation","cloud-healthcare"],"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"}