{"record":{"id":"624e098de52f0eea","repo":"BerriAI/litellm","slug":"missing-required-parameter-parameters","errorCode":null,"errorMessage":"Missing required parameter: parameters","messagePattern":"Missing required parameter: parameters","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/anthropic/chat/transformation.py","lineNumber":690,"sourceCode":"\n            input_anthropic_schema: Final = sanitize_input_schema_for_anthropic(_input_schema)\n\n            _tool: Final = AnthropicMessagesTool(\n                name=tool[\"function\"][\"name\"],\n                input_schema=input_anthropic_schema,\n                type=\"custom\",\n            )\n\n            _description: Final = tool[\"function\"].get(\"description\")\n            if _description is not None:\n                _tool[\"description\"] = _description\n\n            returned_tool = _tool\n\n        elif tool[\"type\"].startswith(\"computer_\"):\n            ## check if all required 'display_' params are given\n            if \"parameters\" not in tool[\"function\"]:\n                raise ValueError(\"Missing required parameter: parameters\")\n\n            _display_width_px: Final[int | None] = tool[\"function\"][\"parameters\"].get(\"display_width_px\")\n            _display_height_px: Final[int | None] = tool[\"function\"][\"parameters\"].get(\"display_height_px\")\n            if _display_width_px is None or _display_height_px is None:\n                raise ValueError(\"Missing required parameter: display_width_px or display_height_px\")\n\n            _computer_tool: Final = AnthropicComputerTool(\n                type=tool[\"type\"],\n                name=tool[\"function\"].get(\"name\", \"computer\"),\n                display_width_px=_display_width_px,\n                display_height_px=_display_height_px,\n            )\n\n            _display_number: Final = tool[\"function\"][\"parameters\"].get(\"display_number\")\n            if _display_number is not None:\n                _computer_tool[\"display_number\"] = _display_number\n\n            returned_tool = _computer_tool","sourceCodeStart":672,"sourceCodeEnd":708,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/anthropic/chat/transformation.py#L672-L708","documentation":"Raised while translating OpenAI-format tools to Anthropic format: for a computer-use tool (type starting with 'computer_'), the tool dict must contain a 'parameters' key inside 'function'. LiteLLM needs that dict to read display dimensions for Anthropic's computer-use tool, so its absence is a client-side request-construction error, thrown before any HTTP call.","triggerScenarios":"Passing tools=[{'type': 'computer_20250124', 'function': {'name': 'computer'}}] (or equivalent) to an anthropic/ model without a 'parameters' dict; building computer-use tools by hand or via a helper that omits parameters.","commonSituations":"Migrating computer-use code from the raw Anthropic SDK (where display params sit at the top level) to LiteLLM's OpenAI-style tool schema; LLM-generated tool definitions missing the parameters field.","solutions":["Add a 'parameters' dict under 'function' for every computer_ tool.","Ensure it includes display_width_px and display_height_px (checked next, at line 695).","If you already have a raw Anthropic computer tool dict, wrap it: {'type': 'computer_20250124', 'function': {'name': 'computer', 'parameters': {...}}}.","Validate tools before calling completion() (see validation below) to fail fast with a clear message."],"exampleFix":"# before\ntools = [{\"type\": \"computer_20250124\", \"function\": {\"name\": \"computer\"}}]\n\n# after\ntools = [{\n    \"type\": \"computer_20250124\",\n    \"function\": {\n        \"name\": \"computer\",\n        \"parameters\": {\n            \"display_width_px\": 1280,\n            \"display_height_px\": 720,\n        },\n    },\n}]","handlingStrategy":"validation","validationCode":"def validate_computer_tools(tools):\n    for t in tools:\n        if str(t.get(\"type\", \"\")).startswith(\"computer_\"):\n            params = t.get(\"function\", {}).get(\"parameters\")\n            if not isinstance(params, dict):\n                raise ValueError(f\"computer tool '{t.get('type')}' needs function.parameters dict\")\n    return tools","typeGuard":"def is_valid_computer_tool(tool) -> bool:\n    return (\n        isinstance(tool, dict)\n        and str(tool.get(\"type\", \"\")).startswith(\"computer_\")\n        and isinstance(tool.get(\"function\", {}).get(\"parameters\"), dict)\n    )","tryCatchPattern":null,"preventionTips":["Centralize computer-use tool construction in one builder function.","Assert required keys in unit tests for tool factories.","Remember LiteLLM expects dimensions nested under function.parameters, unlike the raw SDK."],"tags":["anthropic","tools","computer-use","validation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}