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
Thrown by the dataplexgetdataproduct tool's ValidateSource when the source passed in cannot be asserted to the tool's `compatibleSource` interface, i.e., it does not implement GetDataProduct with the expected signature. The tool only accepts sources capable of fetching a Dataplex data product, so any other source kind (or an incomplete implementation) is rejected with this message. It's a configuration/compatibility error surfaced before Invoke.
Source
Thrown at internal/tools/dataplex/dataplexgetdataproduct/dataplexgetdataproduct.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)
}
paramsMap := params.AsMap()
locationID, ok := paramsMap["locationId"].(string)
if !ok || locationID == "" {
return nil, util.NewAgentError("locationId is required and must be a non-empty string", nil)
}
dataProductID, ok := paramsMap["dataProductId"].(string)
if !ok || dataProductID == "" {
return nil, util.NewAgentError("dataProductId is required and must be a non-empty string", nil)
}View on GitHub (pinned to 8cc6e09de2)
Solutions
- Set the tool's `source` to a Dataplex source implementing GetDataProduct.
- Check the compatibleSource interface at the top of internal/tools/dataplex/dataplexgetdataproduct/dataplexgetdataproduct.go and align your source's method set.
- Implement the missing GetDataProduct method on custom sources with the exact interface signature.
- Fix test fakes to embed the tool's compatibleSource interface.
Example fix
// before // tools: // get-product: // kind: dataplex-get-data-product // source: mysql-source # incompatible // // after // tools: // get-product: // kind: dataplex-get-data-product // source: dataplex-source # implements compatibleSource
Defensive patterns
Strategy: validation
Validate before calling
// At config load time, before running tools:
for name, tl := range loadedTools {
if err := tl.Tool.(interface{ ValidateSource(sources.Source) error }).ValidateSource(loadedSources[tl.Source]); err != nil {
return fmt.Errorf("tool %q: %w", name, err)
}
} Type guard
func isGetDataProductSource(s sources.Source) bool {
_, ok := s.(interface {
GetDataProduct(ctx context.Context, locationId, dataProductId string) (*dataplex.DataProduct, error)
})
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
switch {
case strings.Contains(err.Error(), "not a compatible type"):
return nil, fmt.Errorf("config error: tool requires a dataplex source: %w", err)
default:
return nil, err
}
} Prevention
- Validate every tool/source pair when loading configuration, not at request time.
- Match tool kind to source kind by convention (dataplex-* <-> dataplex).
- Write table-driven tests pairing each tool with correct and incorrect sources.
- Document required source kind in your tool config templates.
When it happens
Trigger: ValidateSource (or server startup wiring) receives a sources.Source whose concrete type is missing GetDataProduct(ctx, locationId, dataProductId) (*dataplex.DataProduct, error); typically from binding the tool to a wrong source in tools.yaml or using a stub in tests.
Common situations: Misconfigured tools.yaml where `source:` names a different database's source; custom source integrations that implement sources.Source but not the Dataplex-specific method; stale source implementations after a method rename; copy-paste of tool blocks without updating the source field.
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/8f91270da370b69c.
Report an issue: GitHub.