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 checks that the source bound to the tool implements the compatibleSource interface (a Cloud Healthcare source with DICOM store support). If the configured source is any other type, the tool cannot resolve its store configuration, so this error is returned.
Source
Thrown at internal/tools/cloudhealthcare/cloudhealthcaregetdicomstore/cloudhealthcaregetdicomstore.go:101
// 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 sourceRef at a cloudhealthcare source
- Check the source's kind in the YAML matches the Cloud Healthcare source type
- Register only compatible source-tool pairs in the config
Example fix
# before
sources:
db:
kind: postgres
...
tools:
get_store:
kind: cloud-healthcare-get-dicom-store
source: db
# after
sources:
hc:
kind: cloud-healthcare
...
tools:
get_store:
kind: cloud-healthcare-get-dicom-store
source: hc Defensive patterns
Strategy: type-guard
Validate before calling
if _, ok := src.(sources.Source); ok {
if _, compat := src.(compatibleSource); !compat {
return fmt.Errorf("source %T is not compatible with cloud-healthcare tools", src)
}
} Type guard
func isCompatibleHealthcareSource(s sources.Source) bool {
_, ok := s.(compatibleSource)
return ok
} Prevention
- Pair each cloud-healthcare tool with a cloud-healthcare source in YAML
- Verify source kinds at config load before tool initialization
- Keep tool and source kinds consistent when copy-pasting configs
When it happens
Trigger: Calling ValidateSource with a sources.Source that does not implement compatibleSource — e.g. pairing the tool with a postgres, bigquery, or non-healthcare source.
Common situations: YAML config where the tool's sourceRef points at the wrong source; renaming/refactoring sources so the reference no longer matches; copy-pasted tool configs reusing an incompatible source name.
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/6ca6a9f3eda433f1.
Report an issue: GitHub.