googleapis/mcp-toolbox · error
invalid source for %q tool: source %q is not a compatible ty
Error message
invalid source for %q tool: source %q is not a compatible type
What it means
ValidateSource requires the tool's source to implement compatibleSource (Cloud Healthcare source with FHIR/DICOM store access). Sources of other types cannot supply the store/project/dataset context, so validation returns this error.
Source
Thrown at internal/tools/cloudhealthcare/cloudhealthcaregetfhirresource/cloudhealthcaregetfhirresource.go:104
// validate interface
var _ tools.Tool = Tool{}
type Tool struct {
tools.BaseTool[Config]
}
func (t Tool) GetSourceName() string {
return t.Cfg.Source
}
func (t Tool) ToConfig() tools.ToolConfig {
return t.Cfg
}
func (t Tool) ValidateSource(source sources.Source) error {
_, ok := source.(compatibleSource)
if !ok {
return fmt.Errorf("invalid source for %q tool: source %q is not a compatible type", t.Cfg.Type, t.Cfg.Source)
}
return nil
}
func (t Tool) Invoke(ctx context.Context, s sources.Source, params parameters.ParamValues, accessToken tools.AccessToken) (any, util.ToolboxError) {
source, ok := s.(compatibleSource)
if !ok {
return nil, util.NewClientServerError("source used is not compatible with the tool", http.StatusInternalServerError, nil)
}
storeID, err := common.ValidateAndFetchStoreID(params, source.AllowedFHIRStores())
if err != nil {
return nil, util.NewAgentError("failed to validate store ID", err)
}
resType, ok := params.AsMap()[typeKey].(string)
if !ok {
return nil, util.NewAgentError(fmt.Sprintf("invalid or missing '%s' parameter; expected a string", typeKey), nil)
}
resID, ok := params.AsMap()[idKey].(string)View on GitHub (pinned to 8cc6e09de2)
Solutions
- Point the tool's sourceRef at a cloudhealthcare source
- Fix the source kind in the YAML config
- Validate source-tool compatibility when loading config
Example fix
# before source: bq_source # after source: healthcare_fhir
Defensive patterns
Strategy: type-guard
Validate before calling
if _, ok := source.(compatibleSource); !ok {
return fmt.Errorf("source %T is not a Cloud Healthcare source", source)
} Type guard
func isCompatibleFHIRSource(s sources.Source) bool {
_, ok := s.(compatibleSource)
return ok
} Prevention
- Use cloud-healthcare sources with healthcare FHIR tools
- Check sourceRef targets after config edits
- Add startup validation for source-tool compatibility
When it happens
Trigger: Calling ValidateSource with a sources.Source that does not satisfy the compatibleSource interface.
Common situations: Tool YAML sourceRef pointing at a non-healthcare source; source kind changes after migration; test harnesses using simplified source fakes.
Related errors
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- invalid source for %q tool: source %q is not a compatible ty
- source is not compatible with the tool
- source is not compatible with the tool
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/cffd302f88b5990f.
Report an issue: GitHub.