Skip to content

Commit 425e460

Browse files
committed
Document FastMCP server instructions
1 parent 3d7b311 commit 425e460

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,36 @@ async def long_running_task(task_name: str, ctx: Context[ServerSession, None], s
372372
_Full example: [examples/snippets/servers/tool_progress.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/tool_progress.py)_
373373
<!-- /snippet-source -->
374374

375+
#### Server Instructions
376+
377+
Use `instructions` to tell clients how the server's tools and resources fit
378+
together. These instructions are returned in the server's `InitializeResult`,
379+
which lets clients surface workflow guidance before the model calls any tools.
380+
381+
Instructions are useful when a server has related tools that should be used in a
382+
particular order, or when tools are grouped by domain and need extra context.
383+
384+
```python
385+
from mcp.server.fastmcp import FastMCP
386+
387+
mcp = FastMCP(
388+
name="Inventory",
389+
instructions=(
390+
"Use lookup_item before update_stock. "
391+
"Use create_purchase_order only after confirming supplier availability."
392+
),
393+
)
394+
```
395+
396+
Clients can read the same value after initialization:
397+
398+
```python
399+
from mcp import Client
400+
401+
async with Client(mcp) as client:
402+
print(client.initialize_result.instructions)
403+
```
404+
375405
#### Structured Output
376406

377407
Tools will return structured results by default, if their return type

0 commit comments

Comments
 (0)