Pass the example gallery through as published - #564
Merged
Conversation
Rendering the gallery here made this server the only way to read it. An agent handed an example's URL, or landing on the page from a search, got HTML and no way to the same text -- and pmndrs/examples is a static export, so it could not render one on demand either. It now writes those documents at build time and links each from its page with rel="alternate". So examples://index and get_example fetch and pass on, and the ~470 lines of rendering that lived here are gone: one rendering, reachable two ways, instead of two that could drift. What stays is the part that belongs to a server taking a name from a model -- that name reaches a URL only if it is the shape a published example has. The agents page now documents both tools. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Rendering the gallery here made this server the only way to read it. An agent handed an example's URL β pasted into a chat, arrived at from a search, run by a vendor with no pmndrs plugin β got HTML and no route to the same text. And pmndrs/examples is a static export, so it could not render one on demand either.
It now writes those documents at build time and links each from its page with
rel="alternate"(pmndrs/examples#179). So this server fetches and passes on.What changes
examples://indexandget_examplereturn what the gallery published, verbatim.renderExample,renderIndex,summaryLine, the fence-length logic and the size threshold all move to pmndrs/examples.β473 / +117. One rendering, reachable two ways, instead of two that could drift.
What stays is the part that belongs to a server taking a name from a model: that name reaches a URL only if it is the shape a published example has, and
indexis refused by name because it is legal kebab-case sitting in the same directory.A coupling that disappears
This server no longer parses any structure from the catalog β it fetches text. The shape drift we would otherwise have had to version against (the catalog redeploys on every merge to pmndrs/examples; this deploys on its own schedule) is simply not expressible anymore.
Docs
The agents page now documents both example tools next to the docs ones: the index line format, what the
~23kmarker means and why its absence is the useful signal, that an example is a snapshot that pins its own versions β and a note that the documents are published, with therel="alternate"that reaches them without MCP.Verification
pnpm exec vitest runβ 94 passing;pnpm run lint,pnpm exec tsc --noEmitexamples://indexreturns 167 lines with the size markers intact,get_example("spotlight-shadows")returns the published document including its asset attribution,../../etc/passwdis refusedOrder
pmndrs/examples#179 ships first. This branch requests
<name>.md, which only exists once that one is deployed; until then it fails with a clearFailed to fetch β¦ Not Foundrather than an empty result β the behaviour the last route test pins. The.jsonfiles it used to read are still there, so nothing breaks in the other direction either.π€ Generated with Claude Code