{"record":{"id":"5f626d1ba1c31196","repo":"googleapis/mcp-toolbox","slug":"invalid-parameters-w","errorCode":null,"errorMessage":"invalid parameters: %w","messagePattern":"invalid parameters: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/internal/invoke/command.go","lineNumber":126,"sourceCode":"\tparams := make(map[string]any)\n\tif paramsInput != \"\" {\n\t\tif err := util.DecodeJSON(strings.NewReader(paramsInput), &params); err != nil {\n\t\t\terrMsg := fmt.Errorf(\"params must be a valid JSON string: %w\", err)\n\t\t\topts.Logger.ErrorContext(ctx, errMsg.Error())\n\t\t\treturn errMsg\n\t\t}\n\t}\n\n\ttoolParams, err := tool.GetParameters(src)\n\tif err != nil {\n\t\terrMsg := fmt.Errorf(\"error getting parameters for tool: %w\", err)\n\t\topts.Logger.ErrorContext(ctx, errMsg.Error())\n\t\treturn errMsg\n\t}\n\n\tparsedParams, err := parameters.ParseParams(toolParams, params, nil)\n\tif err != nil {\n\t\terrMsg := fmt.Errorf(\"invalid parameters: %w\", err)\n\t\topts.Logger.ErrorContext(ctx, errMsg.Error())\n\t\treturn errMsg\n\t}\n\n\tparsedParams, err = tool.EmbedParams(ctx, parsedParams, primitiveMgr)\n\tif err != nil {\n\t\terrMsg := fmt.Errorf(\"error embedding parameters: %w\", err)\n\t\topts.Logger.ErrorContext(ctx, errMsg.Error())\n\t\treturn errMsg\n\t}\n\n\t// Client Auth not supported for ephemeral CLI call\n\trequiresAuth, err := tool.RequiresClientAuthorization(src)\n\tif err != nil {\n\t\terrMsg := fmt.Errorf(\"failed to check auth requirements: %w\", err)\n\t\topts.Logger.ErrorContext(ctx, errMsg.Error())\n\t\treturn errMsg\n\t}","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/cmd/internal/invoke/command.go#L108-L144","documentation":"Thrown by runInvoke (cmd/internal/invoke/command.go:126) when parameters.ParseParams fails to map the user-supplied JSON params onto the tool's parameter schema — missing required parameters, unexpected parameters, or values that cannot be converted to the declared type (string/integer/boolean/array). The wrapped error names the offending parameter.","triggerScenarios":"Invoking a tool with a params object missing a required parameter, containing an unknown key not in the tool schema, or with a wrong-typed value (e.g. string \"abc\" for an integer parameter, number for a boolean).","commonSituations":"Typos in parameter names (camelCase vs snake_case), forgetting a required parameter, passing values as strings when the schema declares integer/boolean, or invoking a prebuilt tool with outdated parameter names after a toolbox upgrade.","solutions":["Read the wrapped error to identify the missing/invalid parameter and correct the params JSON.","Check the exact parameter names and types via `toolbox tools list` or the tool's docs page.","Ensure required parameters are present and values match declared types (unquoted numbers/booleans for non-string types).","If parameter names changed after an upgrade, update your invocation script to the new schema."],"exampleFix":"// before (missing required param, wrong type)\ntoolbox invoke execute_sql '{\"sql\": 123}'\n// after\ntoolbox invoke execute_sql '{\"sql\": \"SELECT 1\"}'","handlingStrategy":"validation","validationCode":"// Fetch the tool manifest and check required params before invoking:\nmanifests, _ := client.ListTools(ctx)\nfor _, m := range manifests {\n  if m.GetName() == \"execute_sql\" {\n    fmt.Println(m.GetParameters()) // verify names/types your params must satisfy\n  }\n}","typeGuard":"func isStringParams(m map[string]any, keys ...string) bool {\n  for _, k := range keys {\n    if _, ok := m[k].(string); !ok {\n      return false\n    }\n  }\n  return true\n}","tryCatchPattern":"if err := runInvoke(...); err != nil {\n  if strings.Contains(err.Error(), \"invalid parameters\") {\n    fmt.Fprintf(os.Stderr, \"usage: toolbox invoke %s '<json matching schema>'\\n\", toolName)\n  }\n}","preventionTips":["Inspect `toolbox tools list` output for exact parameter names and types.","Use unquoted JSON numbers/booleans for non-string parameters.","Match parameter names exactly (usually snake_case) as declared in the tool schema."],"tags":["cli","parameters","schema-validation"],"backgroundTag":"parameter-validation-failed","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"}