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-execute-sql tool rejects configs with an empty Description. The description is required because it is surfaced in the MCP tool manifest for LLM clients; Initialize returns this error before building the tool.

Source

Thrown at internal/tools/spanner/spannerexecutesql/spannerexecutesql.go:69

type Config struct {
	tools.ConfigBase `yaml:",inline"`
	Type             string                 `yaml:"type" validate:"required"`
	Source           string                 `yaml:"source" validate:"required"`
	ReadOnly         bool                   `yaml:"readOnly"`
	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)
	}

	sqlParameter := parameters.NewStringParameter("sql", "The sql to execute.")
	params := parameters.Parameters{sqlParameter}

	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: params.Manifest(), AuthRequired: cfg.AuthRequired},
			params,
		),
	}, nil

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Add a `description:` field to the spanner-execute-sql tool entry.
  2. Set ConfigBase.Description when constructing Config programmatically.
  3. Lint/validate your tools.yaml keys to catch silent empty-string decodes.

Example fix

// before
execute-sql:
  kind: spanner-execute-sql
  source: my-spanner
// after
execute-sql:
  kind: spanner-execute-sql
  source: my-spanner
  description: Executes a SQL statement (DML or DDL) on Spanner.
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

cfg, err := decodeToolConfig(raw)
if err != nil {
	if strings.Contains(err.Error(), "description is required") {
		// patch the config with a description before Initialize
	}
	return err
}

Prevention

When it happens

Trigger: Initializing a spanner-execute-sql Config whose Description field is empty — usually a tools.yaml entry for kind spanner-execute-sql that lacks the `description` key.

Common situations: Omitting `description:` in tools.yaml; programmatic Config construction without Description; a YAML indentation mistake causing the field not to decode.

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/ef43f213ff17e7cd. Report an issue: GitHub.