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
Tool.ValidateSource for mongodb-delete-many rejects sources that do not implement the MongoDB compatibleSource interface. The tool needs a Mongo client from the source to delete documents; an incompatible source type cannot supply one, so the mismatch fails validation.
Source
Thrown at internal/tools/mongodb/mongodbdeletemany/mongodbdeletemany.go:121
// 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()
collection, tbErr := mongodbcommon.ResolveCollection(t.Cfg.Collection, paramsMap)
if tbErr != nil {
return nil, tbErr
}
filterString, err := parameters.PopulateTemplateWithJSON("MongoDBDeleteManyFilter", t.Cfg.FilterPayload, paramsMap)
if err != nil {View on GitHub (pinned to 8cc6e09de2)
Solutions
- Set the tool's `source` to a `mongodb` kind source
- Check that the referenced source name exists under `sources:`
- Run a local config validation/start before deploying
Example fix
// before delete-many: kind: mongodb-delete-many source: my-mysql // after delete-many: kind: mongodb-delete-many source: my-mongodb
Defensive patterns
Strategy: validation
Validate before calling
if err := deleteManyTool.ValidateSource(src); err != nil {
return fmt.Errorf("mongodb-delete-many %q: %w", name, err)
} Prevention
- Attach mongodb-delete-many only to MongoDB sources
- Validate all tool/source bindings at startup
- Audit source references when renaming or changing source kinds
When it happens
Trigger: Attaching mongodb-delete-many to a non-MongoDB source in tools.yaml; the server invokes ValidateSource for each tool/source pair at startup.
Common situations: Tool `source` field pointing at the wrong named source; source kind swapped (e.g. from mongodb to firestore); copy-paste across tool blocks.
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/4767ce1b8a424dd4.
Report an issue: GitHub.