Skip to content

Commit 2268419

Browse files
committed
docs: Annotate unused parameters for structured output examples
Update README and example code to indicate parameters are available but not used for the examples
1 parent 65b36de commit 2268419

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ class WeatherData(BaseModel):
475475

476476

477477
@mcp.tool()
478-
def get_weather(city: str) -> WeatherData:
478+
def get_weather(_city: str) -> WeatherData:
479479
"""Get weather for a city - returns structured data."""
480480
# Simulated weather data
481481
return WeatherData(
@@ -494,14 +494,14 @@ class LocationInfo(TypedDict):
494494

495495

496496
@mcp.tool()
497-
def get_location(address: str) -> LocationInfo:
497+
def get_location(_address: str) -> LocationInfo:
498498
"""Get location coordinates"""
499499
return LocationInfo(latitude=51.5074, longitude=-0.1278, name="London, UK")
500500

501501

502502
# Using dict[str, Any] for flexible schemas
503503
@mcp.tool()
504-
def get_statistics(data_type: str) -> dict[str, float]:
504+
def get_statistics(_data_type: str) -> dict[str, float]:
505505
"""Get various statistics"""
506506
return {"mean": 42.5, "median": 40.0, "std_dev": 5.2}
507507

@@ -519,7 +519,7 @@ class UserProfile:
519519

520520

521521
@mcp.tool()
522-
def get_user(user_id: str) -> UserProfile:
522+
def get_user(_user_id: str) -> UserProfile:
523523
"""Get user profile - returns structured data"""
524524
return UserProfile(name="Alice", age=30, email="alice@example.com")
525525

@@ -546,7 +546,7 @@ def list_cities() -> list[str]:
546546

547547

548548
@mcp.tool()
549-
def get_temperature(city: str) -> float:
549+
def get_temperature(_city: str) -> float:
550550
"""Get temperature as a simple float"""
551551
return 22.5
552552
# Returns: {"result": 22.5}

examples/snippets/servers/structured_output.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class WeatherData(BaseModel):
2020

2121

2222
@mcp.tool()
23-
def get_weather(city: str) -> WeatherData:
23+
def get_weather(_city: str) -> WeatherData:
2424
"""Get weather for a city - returns structured data."""
2525
# Simulated weather data
2626
return WeatherData(
@@ -39,14 +39,14 @@ class LocationInfo(TypedDict):
3939

4040

4141
@mcp.tool()
42-
def get_location(address: str) -> LocationInfo:
42+
def get_location(_address: str) -> LocationInfo:
4343
"""Get location coordinates"""
4444
return LocationInfo(latitude=51.5074, longitude=-0.1278, name="London, UK")
4545

4646

4747
# Using dict[str, Any] for flexible schemas
4848
@mcp.tool()
49-
def get_statistics(data_type: str) -> dict[str, float]:
49+
def get_statistics(_data_type: str) -> dict[str, float]:
5050
"""Get various statistics"""
5151
return {"mean": 42.5, "median": 40.0, "std_dev": 5.2}
5252

@@ -64,7 +64,7 @@ def __init__(self, name: str, age: int, email: str | None = None):
6464

6565

6666
@mcp.tool()
67-
def get_user(user_id: str) -> UserProfile:
67+
def get_user(_user_id: str) -> UserProfile:
6868
"""Get user profile - returns structured data"""
6969
return UserProfile(name="Alice", age=30, email="alice@example.com")
7070

@@ -91,7 +91,7 @@ def list_cities() -> list[str]:
9191

9292

9393
@mcp.tool()
94-
def get_temperature(city: str) -> float:
94+
def get_temperature(_city: str) -> float:
9595
"""Get temperature as a simple float"""
9696
return 22.5
9797
# Returns: {"result": 22.5}

0 commit comments

Comments
 (0)