googleapis/mcp-toolbox · error

description is required for tool %q

Error message

description is required for tool %q

What it means

Config.Initialize in the spanner-sql tool enforces a non-empty Description. The description is required for the MCP tool manifest; an empty one makes the tool invalid, so Initialize returns this error before processing parameters.

Source

Thrown at internal/tools/spanner/spannersql/spannersql.go:73

	Type               string                 `yaml:"type" validate:"required"`
	Source             string                 `yaml:"source" validate:"required"`
	Statement          string                 `yaml:"statement" validate:"required"`
	ReadOnly           bool                   `yaml:"readOnly"`
	Parameters         parameters.Parameters  `yaml:"parameters"`
	TemplateParameters parameters.Parameters  `yaml:"templateParameters"`
	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, paramManifest, err := parameters.ProcessParameters(cfg.TemplateParameters, cfg.Parameters)
	if err != nil {
		return nil, err
	}

	defaultAnnotations := tools.NewDestructiveAnnotations
	if cfg.ReadOnly {
		defaultAnnotations = tools.NewReadOnlyAnnotations
	}

	return Tool{
		BaseTool: tools.NewBaseTool(
			cfg,
			tools.GetAnnotationsOrDefault(cfg.Annotations, defaultAnnotations),
			tools.Manifest{Description: cfg.Description, Parameters: paramManifest, AuthRequired: cfg.AuthRequired},
			allParameters,

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Add `description:` to the spanner-sql tool entry in your config.
  2. Set ConfigBase.Description when building the Config programmatically.
  3. Validate YAML structure to ensure the description field actually decodes.

Example fix

// before
run-sql:
  kind: spanner-sql
  source: my-spanner
  statement: SELECT * FROM users
// after
run-sql:
  kind: spanner-sql
  source: my-spanner
  description: Runs a read-only SQL query against Spanner.
  statement: SELECT * FROM users
Defensive patterns

Strategy: validation

Validate before calling

if cfg.Description == "" {
	return errors.New("spanner-sql: description is required")
}

Try / catch

if err := cfg.Initialize(ctx); err != nil {
	if strings.Contains(err.Error(), "description is required") {
		// supply a description and retry initialization
	}
	return err
}

Prevention

When it happens

Trigger: Initializing a spanner-sql Config with an empty Description — typically a tools.yaml entry of kind spanner-sql missing the `description` key, or a programmatic Config built without it.

Common situations: Missing `description:` in YAML; wrong YAML key spelling/indentation so the field decodes empty; struct literal without Description in Go code.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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