{"record":{"id":"ee78a02e2776c1c0","repo":"googleapis/mcp-toolbox","slug":"description-is-required-for-tool-q-ee78a0","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/mongodb/mongodbdeleteone/mongodbdeleteone.go","lineNumber":74,"sourceCode":"\tSource                  string                 `yaml:\"source\" validate:\"required\"`\n\tDatabase                string                 `yaml:\"database\" validate:\"required\"`\n\tCollection              string                 `yaml:\"collection\"`\n\tCollectionAllowedValues []string               `yaml:\"collectionAllowedValues\"`\n\tFilterPayload           string                 `yaml:\"filterPayload\" validate:\"required\"`\n\tFilterParams            parameters.Parameters  `yaml:\"filterParams\"`\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 := slices.Concat(cfg.FilterParams)\n\n\tif err := mongodbcommon.ValidateCollectionConfig(cfg.Collection, cfg.CollectionAllowedValues); err != nil {\n\t\treturn nil, err\n\t}\n\tallParameters = mongodbcommon.WithRuntimeCollectionParam(cfg.Collection, cfg.CollectionAllowedValues, allParameters)\n\n\tif err := parameters.CheckDuplicateParameters(allParameters); err != nil {\n\t\treturn nil, err\n\t}\n\n\tparamManifest := allParameters.Manifest()\n\tif paramManifest == nil {\n\t\tparamManifest = make([]parameters.ParameterManifest, 0)\n\t}\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/mongodb/mongodbdeleteone/mongodbdeleteone.go#L56-L92","documentation":"This error is thrown by the Config.Initialize method of the mongodb-delete-one tool when the tool's Description field is empty. The library requires every tool to have a non-empty description because it is surfaced in the tool manifest to LLM clients. Configuration validation fails fast at Initialize time rather than at server startup or request time.","triggerScenarios":"Calling Initialize() on a mongodbdeleteone.Config whose Description field is the empty string, e.g. a YAML tool definition that omits the description field or sets it to \"\".","commonSituations":"Hand-written tools.yaml missing the description key; programmatically building Config structs and forgetting Description; template/tool generation code that leaves description blank; renaming config fields so the description no longer deserializes into the struct.","solutions":["Add a non-empty description field to the tool's YAML config entry.","If building Config in Go, set cfg.Description before calling Initialize.","Verify the description key is correctly indented/named in YAML so it deserializes into the Description field."],"exampleFix":"# before\ntools:\n  delete-one-doc:\n    kind: mongodb-delete-one\n    source: my-mongo\n    collection: users\n# after\ntools:\n  delete-one-doc:\n    kind: mongodb-delete-one\n    source: my-mongo\n    collection: users\n    description: Deletes a single document from the users collection by filter.","handlingStrategy":"validation","validationCode":"// Go: validate before Initialize\nif cfg.Description == \"\" {\n    return fmt.Errorf(\"tool %q: description must be non-empty\", cfg.Name)\n}\n_ = cfg.Initialize(context.Background())","typeGuard":"// Go: ensure description is present on the decoded config\nfunc hasDescription(c mongodbdeleteone.Config) bool { return c.Description != \"\" }","tryCatchPattern":"tool, err := cfg.Initialize(context.Background())\nif err != nil && strings.Contains(err.Error(), \"description is required\") {\n    // fall back to a default description and retry\n    cfg.Description = \"Default tool description\"\n    tool, err = cfg.Initialize(context.Background())\n}","preventionTips":["Always include a description key in every tool definition in tools.yaml.","Add a config lint/CI check that every tool entry has a non-empty description.","Use prebuilt configs where descriptions are already provided."],"tags":["go","mongodb","config-validation","tool-configuration"],"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"}