Skip to content

Commit 16a22b6

Browse files
committed
rename
1 parent 7130b07 commit 16a22b6

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

examples/servers/simple-streamablehttp-stateless/mcp_simple_streamablehttp_stateless/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def main(
4141
app = Server("mcp-streamable-http-stateless-demo")
4242

4343
@app.call_tool()
44-
async def call_tool(name: str, arguments: dict) -> list[types.Content]:
44+
async def call_tool(name: str, arguments: dict) -> list[types.ContentBlock]:
4545
ctx = app.request_context
4646
interval = arguments.get("interval", 1.0)
4747
count = arguments.get("count", 5)

examples/servers/simple-streamablehttp/mcp_simple_streamablehttp/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def main(
4545
app = Server("mcp-streamable-http-demo")
4646

4747
@app.call_tool()
48-
async def call_tool(name: str, arguments: dict) -> list[types.Content]:
48+
async def call_tool(name: str, arguments: dict) -> list[types.ContentBlock]:
4949
ctx = app.request_context
5050
interval = arguments.get("interval", 1.0)
5151
count = arguments.get("count", 5)

examples/servers/simple-tool/mcp_simple_tool/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
async def fetch_website(
99
url: str,
10-
) -> list[types.Content]:
10+
) -> list[types.ContentBlock]:
1111
headers = {
1212
"User-Agent": "MCP Test Server (github.com/modelcontextprotocol/python-sdk)"
1313
}
@@ -29,7 +29,7 @@ def main(port: int, transport: str) -> int:
2929
app = Server("mcp-website-fetcher")
3030

3131
@app.call_tool()
32-
async def fetch_tool(name: str, arguments: dict) -> list[types.Content]:
32+
async def fetch_tool(name: str, arguments: dict) -> list[types.ContentBlock]:
3333
if name != "fetch":
3434
raise ValueError(f"Unknown tool: {name}")
3535
if "url" not in arguments:

src/mcp/server/fastmcp/prompts/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
import pydantic_core
88
from pydantic import BaseModel, Field, TypeAdapter, validate_call
99

10-
from mcp.types import Content, TextContent
10+
from mcp.types import ContentBlock, TextContent
1111

1212

1313
class Message(BaseModel):
1414
"""Base class for all prompt messages."""
1515

1616
role: Literal["user", "assistant"]
17-
content: Content
17+
content: ContentBlock
1818

19-
def __init__(self, content: str | Content, **kwargs: Any):
19+
def __init__(self, content: str | ContentBlock, **kwargs: Any):
2020
if isinstance(content, str):
2121
content = TextContent(type="text", text=content)
2222
super().__init__(content=content, **kwargs)
@@ -27,7 +27,7 @@ class UserMessage(Message):
2727

2828
role: Literal["user", "assistant"] = "user"
2929

30-
def __init__(self, content: str | Content, **kwargs: Any):
30+
def __init__(self, content: str | ContentBlock, **kwargs: Any):
3131
super().__init__(content=content, **kwargs)
3232

3333

@@ -36,7 +36,7 @@ class AssistantMessage(Message):
3636

3737
role: Literal["user", "assistant"] = "assistant"
3838

39-
def __init__(self, content: str | Content, **kwargs: Any):
39+
def __init__(self, content: str | ContentBlock, **kwargs: Any):
4040
super().__init__(content=content, **kwargs)
4141

4242

src/mcp/server/fastmcp/server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
from mcp.shared.context import LifespanContextT, RequestContext, RequestT
5454
from mcp.types import (
5555
AnyFunction,
56-
Content,
56+
ContentBlock,
5757
GetPromptResult,
5858
TextContent,
5959
ToolAnnotations,
@@ -256,7 +256,7 @@ def get_context(self) -> Context[ServerSession, object, Request]:
256256
request_context = None
257257
return Context(request_context=request_context, fastmcp=self)
258258

259-
async def call_tool(self, name: str, arguments: dict[str, Any]) -> Sequence[Content]:
259+
async def call_tool(self, name: str, arguments: dict[str, Any]) -> Sequence[ContentBlock]:
260260
"""Call a tool by name with arguments."""
261261
context = self.get_context()
262262
result = await self._tool_manager.call_tool(name, arguments, context=context)
@@ -872,12 +872,12 @@ async def get_prompt(self, name: str, arguments: dict[str, Any] | None = None) -
872872

873873
def _convert_to_content(
874874
result: Any,
875-
) -> Sequence[Content]:
875+
) -> Sequence[ContentBlock]:
876876
"""Convert a result to a sequence of content objects."""
877877
if result is None:
878878
return []
879879

880-
if isinstance(result, Content):
880+
if isinstance(result, ContentBlock):
881881
return [result]
882882

883883
if isinstance(result, Image):

src/mcp/server/lowlevel/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ def call_tool(self):
384384
def decorator(
385385
func: Callable[
386386
...,
387-
Awaitable[Iterable[types.Content]],
387+
Awaitable[Iterable[types.ContentBlock]],
388388
],
389389
):
390390
logger.debug("Registering handler for CallToolRequest")

tests/issues/test_88_random_error.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from mcp.client.session import ClientSession
1212
from mcp.server.lowlevel import Server
1313
from mcp.shared.exceptions import McpError
14-
from mcp.types import Content, TextContent
14+
from mcp.types import ContentBlock, TextContent
1515

1616

1717
@pytest.mark.anyio
@@ -31,7 +31,7 @@ async def test_notification_validation_error(tmp_path: Path):
3131
slow_request_complete = anyio.Event()
3232

3333
@server.call_tool()
34-
async def slow_tool(name: str, arg) -> Sequence[Content]:
34+
async def slow_tool(name: str, arg) -> Sequence[ContentBlock]:
3535
nonlocal request_count
3636
request_count += 1
3737

tests/server/fastmcp/test_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from mcp.types import (
1919
AudioContent,
2020
BlobResourceContents,
21-
Content,
21+
ContentBlock,
2222
EmbeddedResource,
2323
ImageContent,
2424
TextContent,
@@ -194,7 +194,7 @@ def image_tool_fn(path: str) -> Image:
194194
return Image(path)
195195

196196

197-
def mixed_content_tool_fn() -> list[Content]:
197+
def mixed_content_tool_fn() -> list[ContentBlock]:
198198
return [
199199
TextContent(type="text", text="Hello"),
200200
ImageContent(type="image", data="abc", mimeType="image/png"),

0 commit comments

Comments
 (0)