docs: add snippet verification for docs/ pages (#2115)
This commit is contained in:
parent
cfbbd7d71a
commit
1ef124e4a8
1 changed files with 446 additions and 43 deletions
9
examples/snippets/servers/resource_templates.py
Normal file
9
examples/snippets/servers/resource_templates.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
mcp = FastMCP("Template Example")
|
||||
|
||||
|
||||
@mcp.resource("users://{user_id}/profile")
|
||||
def get_user_profile(user_id: str) -> str:
|
||||
"""Read a specific user's profile. The user_id is extracted from the URI."""
|
||||
return f'{{"user_id": "{user_id}", "name": "User {user_id}"}}'
|
||||
Loading…
Reference in a new issue