{"record":{"id":"a200c779b9a97b92","repo":"googleapis/mcp-toolbox","slug":"description-is-required-for-tool-q-a200c7","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/tidb/tidbsql/tidbsql.go","lineNumber":70,"sourceCode":"\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\n// validate interface\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\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\n// validate interface","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/tidb/tidbsql/tidbsql.go#L52-L88","documentation":"Initialize rejects a tool configuration whose 'description' field is empty. Description is mandatory for this tool type (it feeds the LLM tool manifest), so the error fires during startup when the tools.yaml entry omits or leaves blank the 'description' key.","triggerScenarios":"`tidb-sql` tool config missing `description:` or set to empty string; template rendering an empty value.","commonSituations":"Scaffolding many tools quickly and omitting description; bad YAML indentation; copying configs from tools that had description optional.","solutions":["Add a meaningful `description:` to the tidb-sql tool config.","Verify the YAML nesting so the field reaches the Config struct.","Check templated descriptions for empty output."],"exampleFix":"# before\nkind: tidb-sql\nsource: my-tidb\nstatement: SELECT * FROM t WHERE id = ?\n# after\nkind: tidb-sql\nsource: my-tidb\ndescription: \"Get row from table t by id.\"\nstatement: SELECT * FROM t WHERE id = ?","handlingStrategy":"validation","validationCode":"yq '.tools[] | select(.kind == \"tidb-sql\") | select(.description == null or .description == \"\")' tools.yaml","typeGuard":"func validTidbSQL(c tidbsql.Config) error {\n    if c.Description == \"\" { return errors.New(\"description is required\") }\n    return nil\n}","tryCatchPattern":"tool, err := cfg.Initialize(ctx)\nif err != nil {\n    return fmt.Errorf(\"tidb-sql tool invalid: %w\", err)\n}","preventionTips":["Make description mandatory in your config scaffolding scripts.","Add schema validation (JSON schema / yamllint custom rule) for tools.yaml.","Review templated fields for empty rendered output."],"tags":["go","config","validation","tidb"],"backgroundTag":"missing-required-config-field","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"}