{"record":{"id":"6d7c091fa04c1a9d","repo":"googleapis/mcp-toolbox","slug":"description-is-required-for-tool-q-6d7c09","errorCode":null,"errorMessage":"description is required for tool %q","messagePattern":"description is required for tool %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/elasticsearch/elasticsearchexecuteesql/elasticsearchexecuteesql.go","lineNumber":67,"sourceCode":"}\n\ntype Config struct {\n\ttools.ConfigBase `yaml:\",inline\"`\n\tType             string                 `yaml:\"type\" validate:\"required\"`\n\tSource           string                 `yaml:\"source\" validate:\"required\"`\n\tFormat           string                 `yaml:\"format\"`\n\tAnnotations      *tools.ToolAnnotations `yaml:\"annotations,omitempty\"`\n}\n\nvar _ tools.ToolConfig = Config{}\n\nfunc (cfg Config) ToolConfigType() string {\n\treturn resourceType\n}\n\nfunc (cfg Config) Initialize(context.Context) (tools.Tool, error) {\n\tif cfg.Description == \"\" {\n\t\treturn nil, fmt.Errorf(\"description is required for tool %q\", cfg.Name)\n\t}\n\n\tqueryParameter := parameters.NewStringParameter(\"query\", \"The ES|QL statement to execute.\")\n\tparams := parameters.Parameters{queryParameter}\n\n\treturn Tool{\n\t\tBaseTool: tools.NewBaseTool(\n\t\t\tcfg,\n\t\t\ttools.GetAnnotationsOrDefault(cfg.Annotations, tools.NewDestructiveAnnotations),\n\t\t\ttools.Manifest{Description: cfg.Description, Parameters: params.Manifest(), AuthRequired: cfg.AuthRequired},\n\t\t\tparams,\n\t\t),\n\t}, nil\n}\n\nvar _ tools.Tool = Tool{}\n\ntype Tool struct {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/elasticsearch/elasticsearchexecuteesql/elasticsearchexecuteesql.go#L49-L85","documentation":"Config.Initialize for the elasticsearch-execute-esql tool validates that the tool's `description` field is non-empty before constructing the tool. Descriptions are required because they are exposed to LLM clients as the tool's Manifest description; without one the tool is useless to the model. Initialize returns this error and the tool fails to load.","triggerScenarios":"Loading a tools.yaml (or calling Initialize programmatically) where a tool with kind `elasticsearch-execute-esql` omits the `description` field or sets it to an empty string \"\".","commonSituations":"Hand-writing minimal tools.yaml entries and forgetting description; YAML indentation mistakes that leave description nested under the wrong key; template generators that skip optional-looking fields; trimming descriptions during config cleanup.","solutions":["Add a non-empty `description` field to the tool entry in tools.yaml","Check YAML indentation so `description` sits at the same level as `name`/`kind` under the tool","Verify no stray quotes make the value parse as empty (e.g. description: \"\")","Reload the toolbox config and confirm the tool appears in the tool list"],"exampleFix":"// before (tools.yaml)\ntools:\n  execute-esql:\n    kind: elasticsearch-execute-esql\n    source: es\n// after\ntools:\n  execute-esql:\n    kind: elasticsearch-execute-esql\n    source: es\n    description: Runs an ES|QL query against Elasticsearch and returns the results.","handlingStrategy":"validation","validationCode":"// Validate tools.yaml entries before loading:\nfor name, t := range cfg.Tools {\n    if t.Description == \"\" {\n        return fmt.Errorf(\"tool %q is missing a description\", name)\n    }\n}","typeGuard":"func hasDescription(t ToolConfigEntry) bool { return strings.TrimSpace(t.Description) != \"\" }","tryCatchPattern":"_, err := cfg.Initialize(context.Background())\nif err != nil && strings.Contains(err.Error(), \"description is required\") {\n    return fmt.Errorf(\"tools.yaml: add a description to the failing tool: %w\", err)\n}","preventionTips":["Always include a description when scaffolding any tool entry — it is mandatory, not optional","Add a schema/CI check that all tools in tools.yaml have non-empty descriptions","Quote description strings to avoid YAML coercion to empty values","When copying tool blocks, copy the description field too and rewrite its text"],"tags":["go","configuration","validation","yaml"],"backgroundTag":"missing-required-argument","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}