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 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.

Source

Thrown at internal/tools/cloudhealthcare/cloudhealthcarefhirfetchpage/cloudhealthcarefhirfetchpage.go:103

// 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)
	}
	url, ok := params.AsMap()[pageURLKey].(string)
	if !ok {
		return nil, util.NewAgentError(fmt.Sprintf("invalid or missing '%s' parameter; expected a string", pageURLKey), nil)
	}

	var tokenStr string
	var err error
	if source.UseClientAuthorization() {
		tokenStr, err = accessToken.ParseBearerToken()

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Point the tool at a cloud-healthcare source kind in tools.yaml
  2. Verify the source name exists and is of a FHIR-compatible Cloud Healthcare type
  3. Use the documented cloud-healthcare source as the tool's source

Example fix

// before
  fetch-page:
    kind: cloud-healthcare-fhir-fetch-page
    source: pg-src
// after
  fetch-page:
    kind: cloud-healthcare-fhir-fetch-page
    source: healthcare-src
Defensive patterns

Strategy: validation

Validate before calling

// reject bad pairing early
if err := tool.ValidateSource(src); err != nil {
	return fmt.Errorf("config error: %w", err)
}

Type guard

func requireCompatible(src sources.Source) (compatibleSource, error) {
	cs, ok := src.(compatibleSource)
	if !ok { return nil, fmt.Errorf("source %T is not compatible", src) }
	return cs, nil
}

Prevention

When it happens

Trigger: Assigning a non-Cloud-Healthcare source (e.g. postgres, http) to a cloud-healthcare-fhir-fetch-page tool in tools.yaml.

Common situations: Copy-pasted tool configs across integrations; source renamed/repointed to the wrong service; assuming the fetch-page tool works with any HTTP-capable source.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/5ef2aae24c67140b. Report an issue: GitHub.