{"record":{"id":"27b80f85c6716efd","repo":"googleapis/mcp-toolbox","slug":"description-is-required-for-tool-q-27b80f","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/tidbexecutesql/tidbexecutesql.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\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\tsqlParameter := parameters.NewStringParameter(\"sql\", \"The sql to execute.\")\n\tallParameters := parameters.Parameters{sqlParameter}\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: allParameters.Manifest(), AuthRequired: cfg.AuthRequired},\n\t\t\tallParameters,\n\t\t),\n\t}, nil\n}\n\n// validate interface\nvar _ tools.Tool = Tool{}\n","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/tidb/tidbexecutesql/tidbexecutesql.go#L49-L85","documentation":"tidb-execute-sql requires a `description` in the tool config; Initialize rejects empty descriptions before constructing the tool. The description is required because it is included in the tool manifest shown to the LLM client.","triggerScenarios":"A `tidb-execute-sql` tool entry without `description:` or with description: \"\"; templated description resolving empty.","commonSituations":"Writing configs by hand and skipping description; YAML anchor/indent mistakes; bulk-generated configs missing the field.","solutions":["Add a non-empty `description:` field to the tidb-execute-sql tool.","Confirm indentation places description within the tool config.","Ensure any templated description evaluates to non-empty text."],"exampleFix":"# before\nkind: tidb-execute-sql\nsource: my-tidb\n# after\nkind: tidb-execute-sql\nsource: my-tidb\ndescription: \"Run arbitrary SQL against TiDB.\"","handlingStrategy":"validation","validationCode":"yq '.tools[] | select(.kind == \"tidb-execute-sql\") | select(.description == null or .description == \"\") | .name' tools.yaml","typeGuard":"func validTidbTool(c tidbexecutesql.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    log.Fatalf(\"tidb tool config error: %v\", err)\n}","preventionTips":["Include description in every tool definition from the start.","CI-lint configs for mandatory fields.","Double-check YAML indentation when a seemingly-present field is not read."],"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"}