Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ docs = [
# of the default groups so no other environment installs the client (or the
# legacy httpx it depends on). See i18n/README.md.
translate = ["anthropic>=0.121.0"]
codegen = ["datamodel-code-generator==0.57.0"]
codegen = ["datamodel-code-generator==0.81.0"]
Comment thread
claude[bot] marked this conversation as resolved.

[build-system]
requires = ["hatchling", "uv-dynamic-versioning"]
Expand Down
4 changes: 4 additions & 0 deletions scripts/gen_surface_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def run_codegen(schema_path: Path, output_path: Path) -> None:
"--snake-case-field", "--remove-special-field-name-prefix",
"--use-annotated", "--use-field-description", "--use-schema-description",
"--enum-field-as-literal", "all",
"--default-values", '{"ElicitRequestFormParams.mode": "form"}',
"--use-union-operator", "--use-double-quotes",
"--use-type-alias", "--skip-root-model",
"--extra-fields", "ignore",
Expand Down Expand Up @@ -252,6 +253,9 @@ def build(entry: dict[str, str]) -> str:
source = raw.read_text(encoding="utf-8")

source = re.sub(r"\A# generated by datamodel-codegen:\n#[^\n]*\n", "", source)
# Explicit __annotations__ hides declared fields under Python 3.14's deferred annotations.
source = source.replace(' __annotations__ = {\n "__pydantic_extra__": Dict[str, Any],\n }\n', "")
source = source.replace(", Dict,", ",")
# Keep named aliases only for recursive types; other aliases remain ordinary Python types and unions.
for node in reversed(ast.parse(source).body):
if not (
Expand Down
13 changes: 13 additions & 0 deletions tests/types/test_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,19 @@ def test_serialize_server_result_preserves_open_type_extras():
assert sieved["tools"][0]["_meta"] == nested_meta


@pytest.mark.parametrize("input_schema", [{}, {"type": "array"}])
def test_serialize_server_result_rejects_invalid_tool_input_schema(input_schema: dict[str, Any]) -> None:
"""The 2026 spec requires a tool's input schema to declare `type="object"`, even though it allows extra keys."""
result = {
"tools": [{"name": "echo", "inputSchema": input_schema}],
"resultType": "complete",
"ttlMs": 0,
"cacheScope": "private",
}
with pytest.raises(pydantic.ValidationError):
methods.serialize_server_result("tools/list", "2026-07-28", result)


def test_serialize_server_result_drops_top_level_server_info_on_discover_but_keeps_the_meta_stamp():
"""Server identity moved from the discover body to result `_meta` (spec PR #3002):
the sieve drops the removed body key and preserves the `_meta` stamp."""
Expand Down
Loading
Loading