Skip to content

Commit e002155

Browse files
committed
test(server): strengthen outputSchema spot-check to verify actual field names
Mirror the inputSchema spot-check pattern: assert specific known fields ('products' in get_products, 'anyOf' in create_media_buy, 'adcp' + 'supported_protocols' in get_adcp_capabilities) rather than just isinstance checks. Structural regressions on response models now surface in the spot-check test, not only in the full drift comparison. https://claude.ai/code/session_019UpkNNacQ4QS8zcVTRfFQV
1 parent d3cdcaf commit e002155

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

tests/test_mcp_schema_drift.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,18 +563,25 @@ def test_output_schema_spot_check_known_shapes() -> None:
563563
shape so structural changes to response models surface here first."""
564564
tool_schemas = {t["name"]: t.get("outputSchema") for t in ADCP_TOOL_DEFINITIONS}
565565

566-
# get_products response has a top-level products field (simple model)
566+
# get_products: simple model — must advertise the top-level products array
567567
gp = tool_schemas["get_products"]
568568
assert gp is not None, "get_products must have outputSchema"
569-
# Should be a flat object or anyOf — either way, must be a dict
570-
assert isinstance(gp, dict)
569+
assert "products" in gp.get("properties", {}), (
570+
"get_products outputSchema must include the 'products' field"
571+
)
571572

572-
# create_media_buy response is a union (success | error) — anyOf at root
573+
# create_media_buy: union response (success | error) — anyOf at root
573574
cmb = tool_schemas["create_media_buy"]
574575
assert cmb is not None, "create_media_buy must have outputSchema"
575-
assert isinstance(cmb, dict)
576+
assert "anyOf" in cmb, (
577+
"create_media_buy outputSchema should be anyOf (union of success/error variants)"
578+
)
576579

577-
# get_adcp_capabilities response is a simple model
580+
# get_adcp_capabilities: simple model — must advertise adcp + supported_protocols
578581
gac = tool_schemas["get_adcp_capabilities"]
579582
assert gac is not None, "get_adcp_capabilities must have outputSchema"
580-
assert isinstance(gac, dict)
583+
props = gac.get("properties", {})
584+
assert "adcp" in props, "get_adcp_capabilities outputSchema must include 'adcp'"
585+
assert "supported_protocols" in props, (
586+
"get_adcp_capabilities outputSchema must include 'supported_protocols'"
587+
)

0 commit comments

Comments
 (0)