Repository navigation
Clarify non-exploded list matching in URI-template docs and tests - #1
Open
1152405245hwc-coder wants to merge 2 commits into
Open
1152405245hwc-coder wants to merge 2 commits into
1152405245hwc-coder wants to merge 2 commits into
Conversation
cursor
Bot
force-pushed
the
cursor/uri-template-list-matching-docs-109b
branch
from
November 30, 2026 08:56
c7ec59f to
b307be9
Compare
Document that matching does not recover a list from a comma-joined expansion, and pin that limit next to scalar-comma and exploded-list behavior.
cursor
Bot
force-pushed
the
cursor/uri-template-list-matching-docs-109b
branch
from
November 30, 2026 08:57
b307be9 to
680487a
Compare
A successful match returns a scalar, and a simple variable rejects a raw comma while matching. Reserved expansion is where a scalar comma and a list expansion collide.
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.
Fixes modelcontextprotocol#3861
Document the difference between list expansion and inverse matching for non-exploded URI templates, and pin the current behavior in tests. Matching and expansion are unchanged.
Motivation and Context
expand()comma-joins a list passed to a non-exploded variable, which is the expansion RFC 6570 specifies.match()returns that text as one string. A comma in a URI may be the join between list items or text inside a single value, and RFC 6570 does not define a general inverse, so matching does not split on it.Checked against current
main(77001c96, same commit asmodelcontextprotocol/python-sdkmain):UriTemplate.parse("items{/ids}").expand({"ids": ["a", "b"]})isitems/a,b,matchreturns{"ids": "a,b"}, and expanding that match isitems/a%2Cb.items/{ids}does not match its list expansion.items{/ids*}keeps list boundaries, including an encoded comma inside one item.This implements the documentation-and-tests clarification proposed in modelcontextprotocol#3861. Handlers that take a list should use an exploded template such as
{/ids*}.How Has This Been Tested?
uv run --frozen pytest tests/shared/test_uri_template.py tests/docs_src/test_uri_templates.py— 333 passeduv run --frozen ruff check tests/shared/test_uri_template.py— passeduv run --frozen ruff format tests/shared/test_uri_template.py— no changesuv run --frozen pyright tests/shared/test_uri_template.py— 0 errorsdocs/servers/uri-templates.md, using the repo markdownlint config — passedBreaking Changes
None. Documentation and tests only.
Types of changes
Checklist
help wanted, or I'm a maintainer)Additional context
The existing inversion property test draws lists only for exploded variables, so it does not cover every value
expand()accepts. The new tests record that limit and cover the scalar-comma and exploded-list cases the property does not generate.