{"record":{"id":"4dc6627c62a22ed1","repo":"googleapis/mcp-toolbox","slug":"missing-parameter-s","errorCode":null,"errorMessage":"missing parameter %s","messagePattern":"missing parameter (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/util/parameters/parameters.go","lineNumber":272,"sourceCode":"\t\t\tif !ok {\n\t\t\t\treturn \"\", fmt.Errorf(\"templateParameter only supports string arrays\")\n\t\t\t}\n\t\t\tstringValues = append(stringValues, stringVal)\n\t\t}\n\t\treturn strings.Join(stringValues, \", \"), nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"invalid parameter type, expected array of type string\")\n\t}\n}\n\n// GetParams return the ParamValues that are associated with the Parameters.\nfunc GetParams(params Parameters, paramValuesMap map[string]any) (ParamValues, error) {\n\tresultParamValues := make(ParamValues, 0)\n\tfor _, p := range params {\n\t\tk := p.GetName()\n\t\tv, ok := paramValuesMap[k]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"missing parameter %s\", k)\n\t\t}\n\t\tresultParamValues = append(resultParamValues, ParamValue{Name: k, Value: v})\n\t}\n\treturn resultParamValues, nil\n}\n\nfunc ResolveTemplateParams(templateParams Parameters, originalStatement string, paramsMap map[string]any) (string, error) {\n\ttemplateParamsValues, err := GetParams(templateParams, paramsMap)\n\ttemplateParamsMap := templateParamsValues.AsMap()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"error getting template params %s\", err)\n\t}\n\n\tfuncMap := template.FuncMap{\n\t\t\"array\": ConvertArrayParamToString,\n\t}\n\tt, err := template.New(\"statement\").Funcs(funcMap).Parse(originalStatement)\n\tif err != nil {","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/util/parameters/parameters.go#L254-L290","documentation":"GetParams walks the tool's declared Parameters and requires every one to be present in the supplied paramValuesMap; the first missing key aborts with this error. It enforces that every configured parameter receives a value before template rendering or invocation proceeds.","triggerScenarios":"Invoking a tool with an arguments map that omits a declared parameter: an MCP/HTTP call missing a required field, a renamed config parameter still referenced by old clients, or an auth parameter not populated because the caller is unauthenticated.","commonSituations":"LLM clients omitting arguments; name mismatches between client keys and config parameter names; optional parameters without defaults that still must be supplied; framework callers building maps programmatically and dropping keys.","solutions":["Read the parameter name from the error and send a value for it in the request arguments.","Fix key-name mismatches: the client key must exactly equal the parameter's name in the tool config.","Add a default value in the parameter config for values that should be optional.","For auth parameters, ensure the request is authenticated so the library can inject the value."],"exampleFix":"// before: 'limit' missing\ntool.Invoke(ctx, map[string]any{\"query\": \"SELECT 1\"})\n\n// after\ntool.Invoke(ctx, map[string]any{\"query\": \"SELECT 1\", \"limit\": 10})","handlingStrategy":"validation","validationCode":"for _, p := range declaredParams {\n    if _, ok := args[p.GetName()]; !ok {\n        return fmt.Errorf(\"argument %q is required by this tool\", p.GetName())\n    }\n}","typeGuard":"func hasAllParams(args map[string]any, params parameters.Parameters) bool {\n    for _, p := range params {\n        if _, ok := args[p.GetName()]; !ok {\n            return false\n        }\n    }\n    return true\n}","tryCatchPattern":"pv, err := params.GetParams(toolParams, args)\nif err != nil {\n    var missing string\n    if fmt.Sscanf(err.Error(), \"missing parameter %s\", &missing) == 1 {\n        return fmt.Errorf(\"please provide argument %q\", missing)\n    }\n    return err\n}","preventionTips":["Validate request arguments against the tool's parameter list before invoking.","Keep client argument names byte-identical to config parameter names.","Give optional parameters explicit defaults in the tool config.","Return the parameter name back to the LLM so it can self-correct the next turn."],"tags":["parameters","validation","missing-argument"],"backgroundTag":"missing-parameter","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"}