{"record":{"id":"83d03e2eabb1a9a3","repo":"googleapis/mcp-toolbox","slug":"description-is-required-for-tool-q","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/alloydbainl/alloydbainl.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\tNLConfig           string                 `yaml:\"nlConfig\" validate:\"required\"`\n\tNLConfigParameters parameters.Parameters  `yaml:\"nlConfigParameters\"`\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\tnumParams := len(cfg.NLConfigParameters)\n\tquotedNameParts := make([]string, 0, numParams)\n\tplaceholderParts := make([]string, 0, numParams)\n\n\tfor i, paramDef := range cfg.NLConfigParameters {\n\t\tname := paramDef.GetName()\n\t\tescapedName := strings.ReplaceAll(name, \"'\", \"''\") // Escape for SQL literal\n\t\tquotedNameParts = append(quotedNameParts, fmt.Sprintf(\"'%s'\", escapedName))\n\t\tplaceholderParts = append(placeholderParts, fmt.Sprintf(\"$%d\", i+3)) // $1, $2 reserved\n\t}\n\n\tvar stmt string\n\tif numParams > 0 {\n\t\tparamNamesSQL := fmt.Sprintf(\"ARRAY[%s]\", strings.Join(quotedNameParts, \", \"))\n\t\tparamValuesSQL := fmt.Sprintf(\"ARRAY[%s]\", strings.Join(placeholderParts, \", \"))\n\t\t// execute_nl_query is the AlloyDB AI function that executes the natural language query\n\t\t// The first parameter is the natural language query, which is passed as $1","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/alloydbainl/alloydbainl.go#L52-L88","documentation":"Initialize() for the alloydbainl (natural language) tool requires a non-empty description. The description is what the LLM sees to decide when to use the tool, so an empty one is rejected at tool construction time with this error naming the tool.","triggerScenarios":"Creating an alloydbainl tool config (YAML or programmatically) without the description field or with description: \"\", then calling Initialize().","commonSituations":"Minimal tool definitions copied from examples that omit description; templated configs where an interpolated description resolves to empty; hand-edited YAML deleting the field.","solutions":["Add a meaningful description field to the tool config explaining what the NL tool does.","Check for template/variable substitution producing an empty string and fix the source value.","Trim whitespace-only values — the check tests for empty string, so provide real text."],"exampleFix":"// before\ntools:\n  ask-db:\n    kind: alloydbainl\n    source: my-alloydb\n// after\ntools:\n  ask-db:\n    kind: alloydbainl\n    source: my-alloydb\n    description: Answer natural language questions about the AlloyDB database.","handlingStrategy":"validation","validationCode":"if cfg.Description == \"\" {\n    return errors.New(\"alloydbainl tool requires a non-empty description\")\n}\ntool, err := cfg.Initialize(ctx)","typeGuard":null,"tryCatchPattern":"tool, err := cfg.Initialize(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"description is required\") {\n        // add/repair description and retry init\n    }\n    return err\n}","preventionTips":["Always author a clear, specific description for every LLM-facing tool.","Check templated configs for substitutions that can render empty strings.","Add a config linter/schema check that requires description on all tool blocks."],"tags":["configuration","validation","missing-field","alloydb"],"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"}