googleapis/mcp-toolbox · error

description is required for tool %q

Error message

description is required for tool %q

What it means

postgres-execute-sql's Config.Initialize requires a non-empty Description, consistent with all tool configs. The description is required for the tool manifest exposed to MCP clients; an empty one aborts initialization immediately.

Source

Thrown at internal/tools/postgres/postgresexecutesql/postgresexecutesql.go:66

	RunSQL(context.Context, string, []any) (any, error)
}

type Config struct {
	tools.ConfigBase `yaml:",inline"`
	Type             string                 `yaml:"type" validate:"required"`
	Source           string                 `yaml:"source" validate:"required"`
	Annotations      *tools.ToolAnnotations `yaml:"annotations,omitempty"`
}

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 := parameters.Parameters{
		parameters.NewStringParameter("sql", "The sql to execute."),
	}

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

var _ tools.Tool = Tool{}

type Tool struct {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Add a non-empty description to the postgres-execute-sql tool config.
  2. Set cfg.Description in Go before calling Initialize.
  3. Check YAML indentation/key spelling so description deserializes correctly.

Example fix

# before
  execute-sql:
    kind: postgres-execute-sql
    source: my-postgres
# after
  execute-sql:
    kind: postgres-execute-sql
    source: my-postgres
    description: Executes arbitrary SQL against the Postgres database.
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

func hasDescription(c postgresexecutesql.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 = "Execute SQL against Postgres."
    tool, err = cfg.Initialize(context.Background())
}

Prevention

When it happens

Trigger: Initializing a postgresexecutesql.Config with Description == "" — typically a tools.yaml entry for postgres-execute-sql missing the description field.

Common situations: Omitting or misspelling description in YAML; empty-string description; building Config programmatically without setting Description; deserialization issues leaving the field zero-valued.

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