It was 2:47 AM on a Tuesday when our alerting system fired: BadRequestError: tool_calls[0].function.arguments is not valid JSON. Our payment reconciliation pipeline โ€” which depended on a chain of DeepSeek function calls orchestrated over the Model Context Protocol (MCP) โ€” had gone dark. Three hours of digging later, the root cause was a single missing response_format flag in our MCP server config, and the fix took four lines of code. If you have ever stared at a 422 response from a Chinese-hosted DeepSeek deployment wondering why your OpenAI-SDK client refuses to negotiate tools, this guide is for you. Below is the exact stack we ship to production: MCP-shaped tool definitions, the schema we validate against, and the routing layer that lets us call DeepSeek V4 โ€” the function-calling tier that supersedes V3.2 with stricter tool