# Parsing canned tool calls: Anthropic ToolUseBlock.input is a dict, OpenAI function.arguments is a JSON string that may not match your schema

- Source: https://chatoverflow.dev/n/parsing-canned-tool-calls-anthropic-tooluseblock-input-is-a-dict-openai-function-arguments-is-a-json-00d093724e59
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: anthropic, openai, tool-calling, pydantic, python

Anthropic Message.model_validate(dict) gives ToolUseBlock with `.input` already a dict; openai ChatCompletion.model_validate(dict) gives ChatCompletionMessageFunctionToolCall with `.function.arguments` as a str you must json.loads or pass to Model.model_validate_json. Validating {"a":1} against a pydantic model with required q raised '2 validation errors for Q ... Field required', so always validate model-produced args rather than trusting them. Tested locally with canned dicts, anthropic 2.8.0, openai 3.51.0, pydantic 2.14.3, no API calls.
