{"record":{"id":"af8f054d1c3b8b77","repo":"googleapis/mcp-toolbox","slug":"description-is-required-for-tool-q-af8f05","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/looker/lookerlistgitbranches/lookerlistgitbranches.go","lineNumber":71,"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\tprojectIdParameter := parameters.NewStringParameter(\"project_id\", \"The project_id\")\n\tallParameters := parameters.Parameters{projectIdParameter}\n\n\t// finish tool setup\n\treturn Tool{\n\t\tBaseTool: tools.NewBaseTool(\n\t\t\tcfg,\n\t\t\ttools.GetAnnotationsOrDefault(cfg.Annotations, tools.NewReadOnlyAnnotations),\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{}","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/looker/lookerlistgitbranches/lookerlistgitbranches.go#L53-L89","documentation":"Config.Initialize for the looker-list-gitbranches tool validates that the `description` field is non-empty before building the tool. MCP tools must expose a human-readable description to clients; an empty one means the tool spec would be incomplete, so initialization fails fast with this error naming the tool.","triggerScenarios":"Loading a tools.yaml where a tool of kind looker-list-gitbranches omits the `description` field or sets it to an empty string, causing Config.Initialize to return this error.","commonSituations":"Hand-writing YAML and forgetting the description; programmatically constructing Config{} with only Name/Source set; a template or generator emitting minimal tool configs; description lost after YAML indentation mistakes put it under the wrong key.","solutions":["Add a non-empty `description` field to the looker-list-gitbranches tool entry in tools.yaml.","Verify YAML indentation so `description` sits at the tool level, not nested under another key.","If generating configs in code, set cfg.Description before calling Initialize."],"exampleFix":"# before (tools.yaml)\ntools:\n  list-branches:\n    kind: looker-list-gitbranches\n    source: my-looker\n\n# after\ntools:\n  list-branches:\n    kind: looker-list-gitbranches\n    source: my-looker\n    description: Lists git branches for a Looker project","handlingStrategy":"validation","validationCode":"// Go: pre-flight check before loading config\nif cfg.Description == \"\" {\n    return fmt.Errorf(\"tool %q is missing required field: description\", cfg.Name)\n}\n// Or lint the YAML offline:\n// every tools.yaml tool entry must have a non-empty description key","typeGuard":null,"tryCatchPattern":"tool, err := cfg.Initialize(ctx)\nif err != nil && strings.Contains(err.Error(), \"description is required\") {\n    return fmt.Errorf(\"tools.yaml: add a description for tool %s\", cfg.Name)\n}","preventionTips":["Make `description` mandatory in your tool-config template.","Add a CI lint that parses tools.yaml and fails on empty descriptions.","Never strip placeholder descriptions without replacing them.","Check YAML indentation so description is not nested under a sibling key."],"tags":["go","looker","validation","configuration"],"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"}