Skip to content

Conversation

@jlowin
Copy link
Owner

@jlowin jlowin commented Sep 30, 2025

FastMCP already supported RFC 6570 simple expansion ({var}) and wildcard parameters ({var*}). This adds form-style query parameters ({?param1,param2}) to complete our RFC 6570 implementation.

Query parameters provide a clean way to pass optional configuration to resources. Parameters declared with {?...} syntax can be overridden via query string, while optional parameters omitted from the template always use their defaults.

@mcp.resource("data://{id}{?format,limit}")
def get_data(id: str, format: str = "json", limit: int = 10) -> str:
    return f"id={id}, format={format}, limit={limit}"

# Client calls:
# data://123 → uses defaults
# data://123?format=xml → overrides format
# data://123?format=csv&limit=50 → overrides both

Type coercion happens automatically based on function type hints (int, float, bool, str).

@jlowin jlowin added the feature Major new functionality. Reserved for 2-4 significant PRs per release. Not for issues. label Sep 30, 2025
@marvin-context-protocol marvin-context-protocol bot added enhancement Improvement to existing functionality. For issues and smaller PR improvements. server Related to FastMCP server implementation or server-side functionality. and removed feature Major new functionality. Reserved for 2-4 significant PRs per release. Not for issues. labels Sep 30, 2025
@jlowin jlowin added feature Major new functionality. Reserved for 2-4 significant PRs per release. Not for issues. and removed enhancement Improvement to existing functionality. For issues and smaller PR improvements. labels Sep 30, 2025
@jlowin jlowin merged commit 35a8c32 into main Sep 30, 2025
9 of 10 checks passed
@jlowin jlowin deleted the rfc-6570-query-params branch September 30, 2025 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Major new functionality. Reserved for 2-4 significant PRs per release. Not for issues. server Related to FastMCP server implementation or server-side functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants