Repository navigation
Description
Summary
An OpenAPI operation with an application/x-www-form-urlencoded request body sends object-typed properties as a Python repr string. A property filter: {type: object} with {"name": "alice", "age": 30} is transmitted as:
filter=%7B%27name%27%3A+%27alice%27%2C+%27age%27%3A+30%7D&tags=a&tags=b
i.e. filter={'name': 'alice', 'age': 30}. Nested None becomes the literal text None, not null. Per the OAS Encoding Object, object properties default to contentType: application/json, so the value should be filter={"name": "alice", "age": 30}; an explicit style/explode would flatten it to name=alice&age=30. String arrays already repeat correctly (tags=a&tags=b).
Most form-decoding servers reject or mis-store these values, so any OpenAPI endpoint taking a structured form field is unusable through this provider.
Reproduction (current main adf90b6, offline)
spec = {"openapi": "3.0.0", "paths": {"/submit": {"post": {
"requestBody": {"content": {"application/x-www-form-urlencoded": {"schema": {
"type": "object",
"properties": {
"filter": {"type": "object", "properties": {"name": {"type": "string"}, "age": {"type": "integer"}}},
"tags": {"type": "array", "items": {"type": "string"}}}}}}},
...
}}}}with a mock transport capturing request.content; call the tool with {"filter": {"name": "alice", "age": 30}, "tags": ["a", "b"]}.
- actual:
filter=%7B%27name%27%3A+%27alice%27%2C+%27age%27%3A+30%7D&tags=a&tags=b - expected:
filter=%7B%22name%22%3A+%22alice%22%2C+%22age%22%3A+30%7D&tags=a&tags=b
Root cause
fastmcp_slim/fastmcp/utilities/openapi/director.py, RequestDirector.build, application/x-www-form-urlencoded branch (base ~lines 181-185): the body dict is passed directly to httpx2.Request(data=body). httpx stringifies dict/list-of-dict values with str() and ignores per-property encoding overrides for urlencoded bodies.
Suggested fix
Build the form data per property: JSON-encode object-typed values and arrays of objects (honoring an explicit encoding.<prop>.contentType, defaulting to application/json per OAS), leave primitives and arrays of primitives to httpx so they keep repeating the key, and keep multipart/JSON bodies untouched.
Tests
A fix with six regression tests is ready (object inline and $ref, nested null, array of objects, explicit encoding contentType, JSON-body control), using a mock transport that records the raw body. I'll open the linked PR with red/green evidence.
Activity
fix(openapi): JSON-encode object form fields in urlencoded request bo…