From f765ccb081178ba60775172aa57e1de7441708aa Mon Sep 17 00:00:00 2001
From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com>
Date: Mon, 6 Jul 2026 00:27:27 -0400
Subject: [PATCH] docs: migrate example field reads to snake_case for MCP SDK
v2
---
docs/clients/client.mdx | 4 ++--
docs/clients/elicitation.mdx | 2 +-
docs/clients/resources.mdx | 4 ++--
docs/clients/sampling.mdx | 2 +-
docs/clients/tools.mdx | 2 +-
docs/development/tests.mdx | 2 +-
docs/development/v3-notes/v3-features.mdx | 4 ++--
docs/servers/icons.mdx | 10 +++++-----
docs/servers/pagination.mdx | 8 ++++----
docs/servers/sampling.mdx | 8 ++++----
docs/servers/tools.mdx | 2 +-
11 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/docs/clients/client.mdx b/docs/clients/client.mdx
index fc5ddc263..4d985e187 100644
--- a/docs/clients/client.mdx
+++ b/docs/clients/client.mdx
@@ -135,7 +135,7 @@ def greet(name: str) -> str:
async with Client(mcp) as client:
# Initialization already happened automatically
- print(f"Server: {client.initialize_result.serverInfo.name}")
+ print(f"Server: {client.initialize_result.server_info.name}")
print(f"Instructions: {client.initialize_result.instructions}")
print(f"Capabilities: {client.initialize_result.capabilities.tools}")
```
@@ -154,7 +154,7 @@ async with client:
# Initialize manually with custom timeout
result = await client.initialize(timeout=10.0)
- print(f"Server: {result.serverInfo.name}")
+ print(f"Server: {result.server_info.name}")
# Now ready for operations
tools = await client.list_tools()
diff --git a/docs/clients/elicitation.mdx b/docs/clients/elicitation.mdx
index 33adbb6d6..dc0135ae3 100644
--- a/docs/clients/elicitation.mdx
+++ b/docs/clients/elicitation.mdx
@@ -69,7 +69,7 @@ The handler receives four parameters:
- The original MCP elicitation parameters, including the raw JSON schema in `params.requestedSchema`
+ The original MCP elicitation parameters, including the raw JSON schema in `params.requested_schema`
diff --git a/docs/clients/resources.mdx b/docs/clients/resources.mdx
index 1f1aa72cb..197ec6c3e 100644
--- a/docs/clients/resources.mdx
+++ b/docs/clients/resources.mdx
@@ -53,7 +53,7 @@ async with client:
for item in content:
if hasattr(item, 'text'):
print(f"Text content: {item.text}")
- print(f"MIME type: {item.mimeType}")
+ print(f"MIME type: {item.mime_type}")
```
Binary resources include images, PDFs, and other non-text data:
@@ -65,7 +65,7 @@ async with client:
for item in content:
if hasattr(item, 'blob'):
print(f"Binary content: {len(item.blob)} bytes")
- print(f"MIME type: {item.mimeType}")
+ print(f"MIME type: {item.mime_type}")
# Save to file
with open("downloaded_logo.png", "wb") as f:
diff --git a/docs/clients/sampling.mdx b/docs/clients/sampling.mdx
index 5f00ac2fd..b0655989b 100644
--- a/docs/clients/sampling.mdx
+++ b/docs/clients/sampling.mdx
@@ -42,7 +42,7 @@ async def sampling_handler(
conversation.append(f"{message.role}: {content}")
# Use the system prompt if provided
- system_prompt = params.systemPrompt or "You are a helpful assistant."
+ system_prompt = params.system_prompt or "You are a helpful assistant."
# Integrate with your LLM service here
return "Generated response based on the messages"
diff --git a/docs/clients/tools.mdx b/docs/clients/tools.mdx
index 3c6507df8..9422c30a8 100644
--- a/docs/clients/tools.mdx
+++ b/docs/clients/tools.mdx
@@ -175,7 +175,7 @@ async with client:
result = await client.call_tool_mcp("my_tool", {"param": "value"})
# result -> fastmcp.types.CallToolResult
- if result.isError:
+ if result.is_error:
print(f"Tool failed: {result.content}")
else:
print(f"Tool succeeded: {result.content}")
diff --git a/docs/development/tests.mdx b/docs/development/tests.mdx
index 4653368be..d3ade170c 100644
--- a/docs/development/tests.mdx
+++ b/docs/development/tests.mdx
@@ -228,7 +228,7 @@ async def test_tool_schema_generation():
return {"amount": amount, "tax": amount * rate, "total": amount * (1 + rate)}
tools = mcp.list_tools()
- schema = tools[0].inputSchema
+ schema = tools[0].input_schema
# First run: snapshot() is empty, gets auto-populated
# Subsequent runs: compares against stored snapshot
diff --git a/docs/development/v3-notes/v3-features.mdx b/docs/development/v3-notes/v3-features.mdx
index b785b57e1..74ac5b082 100644
--- a/docs/development/v3-notes/v3-features.mdx
+++ b/docs/development/v3-notes/v3-features.mdx
@@ -1205,8 +1205,8 @@ When `list_page_size` is set, `tools/list`, `resources/list`, `resources/templat
```python
async with Client(server) as client:
result = await client.list_tools_mcp()
- while result.nextCursor:
- result = await client.list_tools_mcp(cursor=result.nextCursor)
+ while result.next_cursor:
+ result = await client.list_tools_mcp(cursor=result.next_cursor)
```
Documentation: [Pagination](/servers/pagination)
diff --git a/docs/servers/icons.mdx b/docs/servers/icons.mdx
index a120a8303..589e054f2 100644
--- a/docs/servers/icons.mdx
+++ b/docs/servers/icons.mdx
@@ -19,7 +19,7 @@ from fastmcp.types import Icon
icon = Icon(
src="https://example.com/icon.png",
- mimeType="image/png",
+ mime_type="image/png",
sizes=["48x48"]
)
```
@@ -27,7 +27,7 @@ icon = Icon(
The fields serve different purposes:
- **src**: URL or data URI pointing to the icon image
-- **mimeType** (optional): MIME type of the image (e.g., "image/png", "image/svg+xml")
+- **mime_type** (optional): MIME type of the image (e.g., "image/png", "image/svg+xml")
- **sizes** (optional): Array of size descriptors (e.g., ["48x48"], ["any"])
## Server Icons
@@ -44,12 +44,12 @@ mcp = FastMCP(
icons=[
Icon(
src="https://weather.example.com/icon-48.png",
- mimeType="image/png",
+ mime_type="image/png",
sizes=["48x48"]
),
Icon(
src="https://weather.example.com/icon-96.png",
- mimeType="image/png",
+ mime_type="image/png",
sizes=["96x96"]
),
]
@@ -121,7 +121,7 @@ from fastmcp.utilities.types import Image
# SVG icon as data URI
svg_icon = Icon(
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCI+PHBhdGggZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyczQuNDggMTAgMTAgMTAgMTAtNC40OCAxMC0xMFMxNy41MiAyIDEyIDJ6Ii8+PC9zdmc+",
- mimeType="image/svg+xml"
+ mime_type="image/svg+xml"
)
@mcp.tool(icons=[svg_icon])
diff --git a/docs/servers/pagination.mdx b/docs/servers/pagination.mdx
index 97ad2c7a2..c23e296bc 100644
--- a/docs/servers/pagination.mdx
+++ b/docs/servers/pagination.mdx
@@ -34,7 +34,7 @@ def analyze(data: str) -> dict:
# ... many more tools, resources, prompts
```
-When `list_page_size` is configured, the `tools/list`, `resources/list`, `resources/templates/list`, and `prompts/list` endpoints all paginate their responses. Each response includes a `nextCursor` field when more results exist, which clients use to fetch subsequent pages.
+When `list_page_size` is configured, the `tools/list`, `resources/list`, `resources/templates/list`, and `prompts/list` endpoints all paginate their responses. Each response includes a `next_cursor` field when more results exist, which clients use to fetch subsequent pages.
### Cursor Format
@@ -66,12 +66,12 @@ async with Client(server) as client:
print(f"Page 1: {len(result.tools)} tools")
# Continue fetching while more pages exist
- while result.nextCursor:
- result = await client.list_tools_mcp(cursor=result.nextCursor)
+ while result.next_cursor:
+ result = await client.list_tools_mcp(cursor=result.next_cursor)
print(f"Next page: {len(result.tools)} tools")
```
-The `_mcp` methods return the raw MCP protocol objects, which include both the items and the `nextCursor` for the next page. When `nextCursor` is `None`, you've reached the end of the result set.
+The `_mcp` methods return the raw MCP protocol objects, which include both the items and the `next_cursor` for the next page. When `next_cursor` is `None`, you've reached the end of the result set.
All four list operations support manual pagination:
diff --git a/docs/servers/sampling.mdx b/docs/servers/sampling.mdx
index 4f6b915b3..4043e2ad7 100644
--- a/docs/servers/sampling.mdx
+++ b/docs/servers/sampling.mdx
@@ -443,7 +443,7 @@ async def research(question: str, ctx: Context) -> str:
tool_results.append(
ToolResultContent(
type="tool_result",
- toolUseId=call.id,
+ tool_use_id=call.id,
content=[TextContent(type="text", text=result)],
)
)
@@ -452,14 +452,14 @@ async def research(question: str, ctx: Context) -> str:
messages.append(SamplingMessage(role="user", content=tool_results))
```
-To report an error to the LLM, set `isError=True` on the tool result:
+To report an error to the LLM, set `is_error=True` on the tool result:
```python
tool_result = ToolResultContent(
type="tool_result",
- toolUseId=call.id,
+ tool_use_id=call.id,
content=[TextContent(type="text", text="Permission denied")],
- isError=True,
+ is_error=True,
)
```
diff --git a/docs/servers/tools.mdx b/docs/servers/tools.mdx
index 75030b2ef..bc5b7d228 100644
--- a/docs/servers/tools.mdx
+++ b/docs/servers/tools.mdx
@@ -746,7 +746,7 @@ ToolResult(content="Hello, world!")
# List of content blocks
ToolResult(content=[
TextContent(type="text", text="Result: 42"),
- ImageContent(type="image", data="base64...", mimeType="image/png")
+ ImageContent(type="image", data="base64...", mime_type="image/png")
])
```