{"record":{"id":"66ceb105b6c4dc3a","repo":"googleapis/mcp-toolbox","slug":"description-is-required-for-tool-q-66ceb1","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/cloudstorage/cloudstoragecopyobject/cloudstoragecopyobject.go","lineNumber":74,"sourceCode":"\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\tSourceBucket      *string                `yaml:\"source_bucket,omitempty\"`\n\tDestinationBucket *string                `yaml:\"destination_bucket,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\tif cfg.SourceBucket != nil && *cfg.SourceBucket == \"\" {\n\t\treturn nil, fmt.Errorf(\"source_bucket cannot be empty for tool %q\", cfg.Name)\n\t}\n\tif cfg.DestinationBucket != nil && *cfg.DestinationBucket == \"\" {\n\t\treturn nil, fmt.Errorf(\"destination_bucket cannot be empty for tool %q\", cfg.Name)\n\t}\n\n\tsourceObjectParam := parameters.NewStringParameter(sourceObjectKey, \"Full source object name (path) within the source bucket, e.g. 'path/to/file.txt'.\")\n\tdestinationObjectParam := parameters.NewStringParameter(destinationObjectKey, \"Full destination object name (path) within the destination bucket, e.g. 'path/to/file.txt'.\")\n\tallParameters := parameters.Parameters{}\n\tif cfg.SourceBucket == nil {\n\t\tallParameters = append(allParameters, parameters.NewStringParameter(sourceBucketKey, \"Name of the Cloud Storage bucket containing the source object.\"))\n\t}\n\tallParameters = append(allParameters, sourceObjectParam)\n\tif cfg.DestinationBucket == nil {\n\t\tallParameters = append(allParameters, parameters.NewStringParameter(destinationBucketKey, \"Name of the Cloud Storage bucket to copy into.\"))\n\t}","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudstorage/cloudstoragecopyobject/cloudstoragecopyobject.go#L56-L92","documentation":"The cloud-storage-copyobject tool's Config.Initialize validates the YAML tool definition before constructing the tool. A tool must have a non-empty description, because the description is what the LLM/MCP client sees. If cfg.Description is empty the configuration is rejected at startup.","triggerScenarios":"Defining a copy_object tool in tools.yaml (or via prebuilt config parsing) without the `description` field, so cfg.Description == \"\" when Initialize runs during server startup or config loading.","commonSituations":"Hand-editing tools.yaml and omitting description; templating/generation that drops empty fields; copying a tool block and deleting the description line.","solutions":["Add a non-empty `description` field to the tool's YAML config","Run `toolbox` config validation before deployment to catch it at CI time","Check YAML indentation — a mis-indented description key may parse into a different node and leave the field empty"],"exampleFix":"// before (tools.yaml)\n- name: copy_object\n  source: my-gcs\n// after\n- name: copy_object\n  source: my-gcs\n  description: Copies an object within or between Cloud Storage buckets","handlingStrategy":"validation","validationCode":"func validateCopyObjectTool(cfg map[string]any) error {\n    d, _ := cfg[\"description\"].(string)\n    if strings.TrimSpace(d) == \"\" {\n        return fmt.Errorf(\"tool %v: description is required\", cfg[\"name\"])\n    }\n    return nil\n}","typeGuard":"func hasDescription(cfg Config) bool { return cfg.Description != \"\" }","tryCatchPattern":"tool, err := cfg.Initialize(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"description is required\") {\n        return fmt.Errorf(\"config error in tools.yaml: %w\", err)\n    }\n    return err\n}","preventionTips":["Always author a description when adding a tool block to tools.yaml","Lint tools.yaml for required fields in CI","Beware YAML indentation that silently drops keys","Use the prebuilt configs as templates to see required fields"],"tags":["config","validation","yaml","cloud-storage"],"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"}