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
The dataplex-lookup-context tool requires a source implementing its compatibleSource interface (LookupContext method). ValidateSource returns this error when the injected source is not that type. It guards against mismatched source/tool wiring in the toolbox configuration.
Source
Thrown at internal/tools/dataplex/dataplexlookupcontext/dataplexlookupcontext.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)
}
paramsMap := params.AsMap()
resourcesSlice, err := parameters.ConvertAnySliceToTyped(paramsMap["resources"].([]any), "string")
if err != nil {
return nil, util.NewAgentError(fmt.Sprintf("can't convert resources to array of strings: %s", err), err)
}
resources := resourcesSlice.([]string)
if len(resources) == 0 {
err := fmt.Errorf("resources cannot be empty")View on GitHub (pinned to 8cc6e09de2)
Solutions
- Attach a dataplex source to the tool in the YAML config
- Check the source name referenced by the tool exists and is of kind dataplex
- Run the server and verify startup validation passes for this tool
Example fix
// before source: cloud-sql-postgres // after source: dataplex
Defensive patterns
Strategy: type-guard
Validate before calling
if _, ok := src.(interface {
LookupContext(ctx context.Context, name string, resources []string) (*dataplex.GoogleCloudDataplexV1LookupContextResponse, error)
}); !ok {
return fmt.Errorf("source %T does not support LookupContext", src)
} Type guard
func isDataplexLookupContextSource(s sources.Source) bool {
_, ok := s.(interface {
LookupContext(ctx context.Context, name string, resources []string) (*dataplex.GoogleCloudDataplexV1LookupContextResponse, error)
})
return ok
} Try / catch
err := tool.ValidateSource(src)
if err != nil {
// incompatible source: correct the tool->source mapping and reinit
return fmt.Errorf("rebind tool to a dataplex source: %w", err)
} Prevention
- Keep one dataplex source and reference it explicitly by name in each dataplex tool
- Validate config with startup checks before serving traffic
- Avoid copying tool blocks across integrations without updating source
When it happens
Trigger: ValidateSource is called with a sources.Source that does not implement compatibleSource (LookupContext(ctx, name, resources)) for dataplex-lookup-context.
Common situations: Tool config points at a wrong source (e.g. a database source instead of dataplex); hand-edited YAML with a typo in the source name resolving to another source.
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
- invalid source for %q tool: source %q is not a compatible ty
- 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/9f00b9bf4f0f98d5.
Report an issue: GitHub.