Skip to content

Commit 988fbbf

Browse files
committed
Leave the migration guide alone; these are 2.x fixes, not v1->v2 breaks
The migration guide documents breaking changes between majors. Nothing here changes a signature or documented behaviour, so the notes belong in the release notes, not the guide. No-Verification-Needed: docs-only revert
1 parent d26de07 commit 988fbbf

1 file changed

Lines changed: 3 additions & 19 deletions

File tree

docs/migration.md

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ All submodules under `mcp.server.fastmcp.*` are now under `mcp.server.mcpserver.
668668

669669
- `Image`, `Audio` — from `mcp.server.mcpserver` (or `.utilities.types`)
670670
- `Icon` — from `mcp.server.mcpserver` or `mcp.types` (not a top-level `mcp` export); its `mimeType` field is now `mime_type` per the [snake_case renames](#field-names-changed-from-camelcase-to-snake_case), though the `mimeType=` kwarg still constructs
671-
- `Message`, `UserMessage`, `AssistantMessage` — from `mcp.server.mcpserver` (or `.prompts.base`)
671+
- `Message`, `UserMessage`, `AssistantMessage` — from `mcp.server.mcpserver.prompts.base`
672672
- `ToolError`, `ResourceError` — from `mcp.server.mcpserver.exceptions`
673673
- `MCPServerError` (renamed from `FastMCPError`) — from `mcp.server.mcpserver.exceptions`
674674

@@ -677,8 +677,8 @@ All submodules under `mcp.server.fastmcp.*` are now under `mcp.server.mcpserver.
677677
Beyond the changes covered in this section, the everyday `FastMCP` surface carries over to `MCPServer` as-is:
678678

679679
- **Decorators.** `@mcp.tool()`, `@mcp.resource()`, `@mcp.prompt()`, and `@mcp.completion()` take the same arguments and handler signatures as v1. The lowlevel [`on_completion` reshape](#lowlevel-server-decorator-based-handlers-replaced-with-constructor-on_-params) applies only to the lowlevel `Server`; a high-level `@mcp.completion()` handler is still called as `(ref, argument, context)`.
680-
- **Tool return handling.** A returned `CallToolResult` (including an `Annotated[CallToolResult, YourModel]` output schema, and `_meta`) is passed through, `Image` and `Audio` convert to content blocks as before, ready-made content blocks are kept as-is (neither is [structured by default](#content-block-image-and-audio-return-annotations-are-unstructured) now, even inside a `list`), and dict, list, scalar, and model returns are wrapped into `content` and `structured_content` by the same rules.
681-
- **Listing and registration methods.** `list_tools()`, `list_resources()`, `list_resource_templates()`, and `list_prompts()` return the same lists and are still what the protocol handlers call, so subclass overrides still take effect. `add_tool()`, `add_resource()`, and `add_prompt()` are unchanged (`add_prompt()` additionally accepts the plain function, like `add_tool()`).
680+
- **Tool return handling.** A returned `CallToolResult` (including an `Annotated[CallToolResult, YourModel]` output schema, and `_meta`) is passed through, `Image` and `Audio` convert to content blocks as before, ready-made content blocks are kept as-is, and dict, list, scalar, and model returns are wrapped into `content` and `structured_content` by the same rules.
681+
- **Listing and registration methods.** `list_tools()`, `list_resources()`, `list_resource_templates()`, and `list_prompts()` return the same lists and are still what the protocol handlers call, so subclass overrides still take effect. `add_tool()`, `add_resource()`, and `add_prompt()` are unchanged.
682682
- **Helpers.** `Image.to_image_content()`, `Audio.to_audio_content()`, and the prompt `Message`, `UserMessage`, and `AssistantMessage` classes.
683683
- **Lifespan.** The `lifespan=` constructor argument and `ctx.request_context.lifespan_context` work as before, and the class is still generic over the lifespan result: `FastMCP[MyState]` becomes `MCPServer[MyState]`. (`Context`'s own type parameters did change; see [`RequestContext` type parameters simplified](#requestcontext-type-parameters-simplified).)
684684
- **Tool internals.** `Tool`, `Tool.from_function()`, `FuncMetadata`, `ArgModelBase`, and `func_metadata()` keep their v1 shapes; the one change is the now-required `context` argument to `Tool.run()`, described [below](#mcpservercall_tool-read_resource-get_prompt-now-accept-a-context-parameter).
@@ -924,22 +924,6 @@ running on the event-loop thread:
924924

925925
Declare the handler `async def` to keep it on the event loop.
926926

927-
### Content-block, `Image`, and `Audio` return annotations are unstructured
928-
929-
A tool whose return annotation mentions a content block (`TextContent`,
930-
`ImageContent`, `AudioContent`, `ResourceLink`, `EmbeddedResource`), `Image`, or
931-
`Audio` anywhere (alone, or inside a `list`, `tuple`, or union) now registers
932-
with no `output_schema` and returns no `structured_content`; `content` is built
933-
exactly as before. v1 (and 2.0) published the block type's own Pydantic schema as
934-
the tool's `output_schema` and echoed the serialized blocks into
935-
`structured_content` a second time, while an annotation with `Image` or `Audio`
936-
inside a generic (`-> list[Image]`) raised at registration (a bare `-> Image` was
937-
already unstructured).
938-
939-
If a client reads `structured_content` from such a tool, return a model,
940-
`TypedDict`, or `dict` instead, or pass `structured_output=True` to keep
941-
publishing a content block's schema.
942-
943927
### `MCPServer.call_tool()` returns `CallToolResult`
944928

945929
`MCPServer.call_tool()` now returns a `CallToolResult` (or an

0 commit comments

Comments
 (0)