{"record":{"id":"02dd30fd7b7fd010","repo":"googleapis/mcp-toolbox","slug":"description-is-required-for-tool-q-02dd30","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/postgres/postgressql/postgressql.go","lineNumber":70,"sourceCode":"type Config struct {\n\ttools.ConfigBase   `yaml:\",inline\"`\n\tType               string                 `yaml:\"type\" validate:\"required\"`\n\tSource             string                 `yaml:\"source\" validate:\"required\"`\n\tStatement          string                 `yaml:\"statement\" validate:\"required\"`\n\tParameters         parameters.Parameters  `yaml:\"parameters\"`\n\tTemplateParameters parameters.Parameters  `yaml:\"templateParameters\"`\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\tallParameters, paramManifest, err := parameters.ProcessParameters(cfg.TemplateParameters, cfg.Parameters)\n\tif err != nil {\n\t\treturn nil, err\n\t}\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: paramManifest, AuthRequired: cfg.AuthRequired},\n\t\t\tallParameters,\n\t\t),\n\t}, nil\n}\n\nvar _ tools.Tool = Tool{}\n","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/postgres/postgressql/postgressql.go#L52-L88","documentation":"The postgres-sql tool's Initialize returns this error when the tool's `description` field is empty in tools.yaml. Every tool requires a human-readable description because it is surfaced to the LLM as the tool's manifest description, letting the model decide when to invoke the tool.","triggerScenarios":"Calling Initialize during server startup for a `kind: postgres-sql` tool whose YAML entry omits the `description:` field or sets it to an empty string.","commonSituations":"Writing a new tool entry by hand and forgetting the description; a templating/scripted config generator emitting empty descriptions; YAML indentation mistakes that place `description` under the wrong key so it never binds.","solutions":["Add a non-empty `description:` field to the postgres-sql tool entry in tools.yaml","Check YAML indentation so `description` is a sibling of `kind`, `source`, and `statement`","Validate the config with the toolbox binary before deploying"],"exampleFix":"# before\nmy-tool:\n  kind: postgres-sql\n  source: postgres-prod\n  statement: SELECT 1\n# after\nmy-tool:\n  kind: postgres-sql\n  source: postgres-prod\n  description: Runs a SQL statement against Postgres and returns the rows.\n  statement: SELECT 1","handlingStrategy":"validation","validationCode":"// pre-validate the tool entry before handing it to the toolbox\ncfg, _ := yaml.Marshal(toolEntry)\nvar check struct {\n\tDescription string `yaml:\"description\"`\n}\nif err := yaml.Unmarshal(cfg, &check); err != nil || check.Description == \"\" {\n\treturn fmt.Errorf(\"tool %q: description is required and must be non-empty\", toolName)\n}","typeGuard":null,"tryCatchPattern":"if err := server.Start(ctx); err != nil {\n\tvar cfgErr *config.ConfigError\n\tif errors.As(err, &cfgErr) && strings.Contains(err.Error(), \"description is required\") {\n\t\tlog.Fatalf(\"config error: add a description to tool %q: %v\", cfgErr.Tool, err)\n\t}\n\treturn err\n}","preventionTips":["Always include a meaningful `description:` for every tool in tools.yaml","Treat description as required documentation for the LLM, not optional metadata","Run `toolbox --tools-file tools.yaml` as a CI check before deploy","Watch YAML indentation so `description` binds to the tool, not a nested key"],"tags":["go","config","validation","missing-field","postgres"],"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"}