From f1a752013e6719748c15bbf6e7024b1d533e41b6 Mon Sep 17 00:00:00 2001 From: mukunda katta Date: Mon, 27 Apr 2026 19:03:11 -0700 Subject: [PATCH] Document FastMCP server instructions --- README.v2.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.v2.md b/README.v2.md index d0851c04e..5579120d0 100644 --- a/README.v2.md +++ b/README.v2.md @@ -370,6 +370,35 @@ async def long_running_task(task_name: str, ctx: Context, steps: int = 5) -> str _Full example: [examples/snippets/servers/tool_progress.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/tool_progress.py)_ +#### Server Instructions + +Use `instructions` to tell clients how the server's tools and resources fit +together. These instructions are returned in the server's `InitializeResult`, +which lets clients surface workflow guidance before the model calls any tools. + +Instructions are useful when a server has related tools that should be used in a +particular order, or when tools are grouped by domain and need extra context. + +```python +from mcp.server import MCPServer + +mcp = MCPServer( + name="Inventory", + instructions=( + "Use lookup_item before update_stock. " + "Use create_purchase_order only after confirming supplier availability." + ), +) +``` + +Inside a tool you can read the same value via the request context: + +```python +@mcp.tool() +async def describe_workflow(ctx: Context) -> str: + return ctx.mcp_server.instructions or "(no instructions provided)" +``` + #### Structured Output Tools will return structured results by default, if their return type