Split protocol types into a standalone mcp-types package (#2973)
This commit is contained in:
parent
03681ed55e
commit
0ee7f1b293
1 changed files with 1040 additions and 867 deletions
|
|
@ -1,7 +1,7 @@
|
|||
"""Regenerate the per-version wire-shape surface packages from vendored schemas.
|
||||
|
||||
Runs `datamodel-code-generator` over each `schema/PINNED.json` entry and
|
||||
writes the result to `src/mcp/types/v<version>/__init__.py` with only the
|
||||
writes the result to `src/mcp-types/mcp_types/v<version>/__init__.py` with only the
|
||||
fixes the raw output needs: a small JSON pre-patch for the known
|
||||
`number`-as-`integer` schema.json defect, a header, full URLs for the spec's
|
||||
site-absolute doc links, and per-version epilogue aliases. Run with
|
||||
|
|
@ -23,7 +23,7 @@ from typing import Any
|
|||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
SCHEMA_DIR = REPO_ROOT / "schema"
|
||||
TYPES_DIR = REPO_ROOT / "src" / "mcp" / "types"
|
||||
TYPES_DIR = REPO_ROOT / "src" / "mcp-types" / "mcp_types"
|
||||
|
||||
# schema.ts -> schema.json renders TypeScript `number` as JSON Schema
|
||||
# `integer` at these sites; patch the JSON before codegen so floats validate.
|
||||
|
|
@ -142,7 +142,7 @@ def run_codegen(schema_path: Path, output_path: Path) -> None:
|
|||
"--output", str(output_path),
|
||||
"--output-model-type", "pydantic_v2.BaseModel",
|
||||
"--target-python-version", "3.10",
|
||||
"--base-class", "mcp.types._wire_base.WireModel",
|
||||
"--base-class", "mcp_types._wire_base.WireModel",
|
||||
"--snake-case-field", "--remove-special-field-name-prefix",
|
||||
"--use-annotated", "--use-field-description", "--use-schema-description",
|
||||
"--enum-field-as-literal", "all",
|
||||
|
|
|
|||
Loading…
Reference in a new issue