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 type-asserts the provided sources.Source against the tool's compatibleSource interface. If the source wired to this firestore-delete-documents tool does not implement that interface (i.e., is not the Firestore source), the tool refuses to run. This is a wiring/manifest validation guard that fires before any Firestore API call is made.
Source
Thrown at internal/tools/firestore/firestoredeletedocuments/firestoredeletedocuments.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)
}
mapParams := params.AsMap()
documentPathsRaw, ok := mapParams[documentPathsKey].([]any)
if !ok {
return nil, util.NewAgentError(fmt.Sprintf("invalid or missing '%s' parameter; expected an array", documentPathsKey), nil)
}
if len(documentPathsRaw) == 0 {
return nil, util.NewAgentError(fmt.Sprintf("'%s' parameter cannot be empty", documentPathsKey), nil)
}
View on GitHub (pinned to 8cc6e09de2)
Solutions
- Set the tool's `source:` field in the YAML to the name of a firestore-kind source.
- Verify the referenced source's `kind: firestore` matches the tool's expected type.
- If constructing programmatically, pass the *firestore.Source instance (not another source) to ValidateSource/Invoke.
Example fix
// before
tools:
delete_doc:
kind: firestore-delete-documents
source: my-postgres
// after
tools:
delete_doc:
kind: firestore-delete-documents
source: my-firestore Defensive patterns
Strategy: type-guard
Validate before calling
func validateFirestoreSource(name string, src sources.Source) error {
if _, ok := src.(interface{ FirestoreClient() *firestore.Client }); !ok {
return fmt.Errorf("tool requires a firestore source, got %T", src)
}
return nil
} Type guard
func isCompatibleFirestoreSource(s sources.Source) bool {
_, ok := s.(firestore.CompatibleSource)
return ok
} Try / catch
if err := tool.ValidateSource(src); err != nil {
// handle: wrong source bound to tool
log.Printf("config error: %v", err)
return err
} Prevention
- Keep a 1:1 mapping between firestore-* tools and firestore-kind sources in YAML.
- Validate the whole config with `toolbox --dry-run` style startup before deploying.
- Use distinct, descriptive source names so cross-wiring is obvious in review.
When it happens
Trigger: Calling toolset/manifest resolution or Invoke with a source registered for the tool whose concrete Go type does not satisfy compatibleSource (e.g., a postgres or cloudsql source instead of the firestore source).
Common situations: YAML configs where the tool's `source:` field points at a source of a different kind; programmatic construction of the tool with the wrong sources.Source; copy-pasting a tool block between sources without updating the 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
- 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/d31ca96352592021.
Report an issue: GitHub.