Skip to content

Commit 6f8fce3

Browse files
committed
Expand site-absolute spec links in generated docstrings to full URLs
The vendored schema descriptions link to spec pages with site-absolute paths like (/specification/2025-11-25/basic/index#meta). Copied verbatim into the generated per-version docstrings, those links don't resolve from the rendered API reference, and mkdocs' link validation flags each one as a warning, so the strict docs build on main aborts (54 warnings, all from api/mcp/types/v2025_11_25/). Rewrite site-absolute markdown link targets to full https://modelcontextprotocol.io/... URLs in the generator's post-processing and regenerate the 2025-11-25 package. The 2026-07-28 package has no such links and is unchanged.
1 parent 65be5a7 commit 6f8fce3

2 files changed

Lines changed: 61 additions & 56 deletions

File tree

scripts/gen_surface_types.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
Runs `datamodel-code-generator` over each `schema/PINNED.json` entry and
44
writes the result to `src/mcp/types/v<version>/__init__.py` with only the
55
fixes the raw output needs: a small JSON pre-patch for the known
6-
`number`-as-`integer` schema.json defect, a header, and per-version
7-
epilogue aliases. Run with `uv run --frozen --group codegen python scripts/gen_surface_types.py [--check]`.
6+
`number`-as-`integer` schema.json defect, a header, full URLs for the spec's
7+
site-absolute doc links, and per-version epilogue aliases. Run with
8+
`uv run --frozen --group codegen python scripts/gen_surface_types.py [--check]`.
89
"""
910

1011
from __future__ import annotations
@@ -198,6 +199,10 @@ def build(entry: dict[str, str]) -> str:
198199
# Codegen appends `| None` to forward refs of nullable models, which is a
199200
# runtime TypeError on a string ref and redundant since `JSONValue` includes None.
200201
source = source.replace('"JSONValue" | None', '"JSONValue"')
202+
# Schema descriptions link to spec-site pages with site-absolute paths; expand
203+
# them to full URLs so they resolve from the rendered API docs and pass the
204+
# strict mkdocs link validation.
205+
source = source.replace("](/", "](https://modelcontextprotocol.io/")
201206
source = allow_open_class_extras(source, OPEN_CLASSES[version])
202207
if epilogue := EPILOGUES.get(version, ""):
203208
# Insert before the trailing model_rebuild() block: pyright's evaluation

0 commit comments

Comments
 (0)