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 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.
Source
Thrown at internal/tools/cloudhealthcare/cloudhealthcareretrieverendereddicominstance/cloudhealthcareretrieverendereddicominstance.go:106
// 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.AllowedDICOMStores())
if err != nil {
return nil, util.NewAgentError("failed to validate store ID", err)
}
var tokenStr string
if source.UseClientAuthorization() {
tokenStr, err = accessToken.ParseBearerToken()
if err != nil {
return nil, util.NewClientServerError("error parsing access token", http.StatusUnauthorized, err)View on GitHub (pinned to 8cc6e09de2)
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)
Example fix
// before (tools.yaml) source: cloudsql-postgres-prod // after source: healthcare-fhir-dicom-store
Defensive patterns
Strategy: type-guard
Validate before calling
// in tools.yaml, ensure kinds line up: // tool kind: cloudhealthcare-retrieve-rendered-dicom-instance // source kind: cloudhealthcare
Type guard
func isHealthcareSource(s sources.Source) bool {
_, ok := s.(cloudhealthcare.Source)
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
if strings.Contains(err.Error(), "not a compatible type") {
log.Fatalf("tool %s must bind a cloudhealthcare source", tool.GetName())
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- invalid source for %q tool: source %q is not a compatible ty
- description is required for tool %q
- invalid source for %q tool: source %q is not a compatible ty
- description is required for tool %q
- invalid source for %q tool: source %q is not a compatible ty
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/43769af9fb2b5922.
Report an issue: GitHub.