googleapis/mcp-toolbox · error

description is required for tool %q

Error message

description is required for tool %q

What it means

Same validation as mongodb-delete-one: mongodbfind.Config.Initialize rejects an empty Description field. The description is required so the tool can be advertised meaningfully to MCP clients in the manifest. Initialization aborts before parameters or collection config are processed.

Source

Thrown at internal/tools/mongodb/mongodbfind/mongodbfind.go:81

	FilterParams            parameters.Parameters  `yaml:"filterParams"`
	ProjectPayload          string                 `yaml:"projectPayload"`
	ProjectParams           parameters.Parameters  `yaml:"projectParams"`
	SortPayload             string                 `yaml:"sortPayload"`
	SortParams              parameters.Parameters  `yaml:"sortParams"`
	Limit                   int64                  `yaml:"limit"`
	Annotations             *tools.ToolAnnotations `yaml:"annotations,omitempty"`
}

// validate interface
var _ tools.ToolConfig = Config{}

func (cfg Config) ToolConfigType() string {
	return resourceType
}

func (cfg Config) Initialize(context.Context) (tools.Tool, error) {
	if cfg.Description == "" {
		return nil, fmt.Errorf("description is required for tool %q", cfg.Name)
	}

	allParameters := slices.Concat(cfg.FilterParams, cfg.ProjectParams, cfg.SortParams)

	if err := mongodbcommon.ValidateCollectionConfig(cfg.Collection, cfg.CollectionAllowedValues); err != nil {
		return nil, err
	}
	allParameters = mongodbcommon.WithRuntimeCollectionParam(cfg.Collection, cfg.CollectionAllowedValues, allParameters)

	if err := parameters.CheckDuplicateParameters(allParameters); err != nil {
		return nil, err
	}

	if cfg.Limit <= 0 {
		return nil, fmt.Errorf("limit must be a positive number, but got %d", cfg.Limit)
	}

	paramManifest := allParameters.Manifest()

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Add a non-empty description to the mongodb-find tool config.
  2. Set cfg.Description in Go before Initialize.
  3. Double-check YAML key spelling/indentation for the description field.

Example fix

# before
  find-users:
    kind: mongodb-find
    source: my-mongo
    collection: users
# after
  find-users:
    kind: mongodb-find
    source: my-mongo
    collection: users
    description: Finds documents in the users collection matching a filter.
Defensive patterns

Strategy: validation

Validate before calling

if cfg.Description == "" {
    return errors.New("mongodb-find tool requires a non-empty description")
}

Type guard

func hasDescription(c mongodbfind.Config) bool { return c.Description != "" }

Try / catch

tool, err := cfg.Initialize(context.Background())
if err != nil && strings.Contains(err.Error(), "description is required") {
    cfg.Description = "Find documents in a MongoDB collection."
    tool, err = cfg.Initialize(context.Background())
}

Prevention

When it happens

Trigger: Calling Initialize() on a mongodbfind.Config with Description == "", typically from a tools.yaml entry for a mongodb-find tool missing the description field.

Common situations: Omitting description in YAML; empty-string description; deserialization mismatch leaving Description zero-valued; scaffolding a new find tool from a minimal template.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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