Skip to content

Commit 8a666f2

Browse files
fix: rewrite server instructions to focus on workflows
Replace verbose tool/resource enumeration with concise workflow-focused instructions. Clients discover available tools/resources via list methods; instructions should guide usage patterns and multi-tool flows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 39262f1 commit 8a666f2

File tree

1 file changed

+15
-42
lines changed

1 file changed

+15
-42
lines changed

mcp_starter/server.py

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -32,60 +32,33 @@
3232
3333
A demonstration MCP server showcasing Python/FastMCP capabilities.
3434
35-
## Available Tools
36-
37-
### Greeting & Demos
38-
- **hello**: Simple greeting - use to test connectivity
39-
- **get_weather**: Returns simulated weather data
40-
- **long_task**: Demonstrates progress reporting (takes ~5 seconds)
41-
42-
### LLM Interaction
43-
- **ask_llm**: Invoke LLM sampling to ask questions (requires client support)
44-
45-
### Dynamic Features
46-
- **load_bonus_tool**: Dynamically adds a calculator tool at runtime
47-
- **bonus_calculator**: Available after calling load_bonus_tool
48-
49-
### Elicitation (User Input)
50-
- **confirm_action**: Demonstrates schema elicitation - requests user confirmation
51-
- **get_feedback**: Demonstrates URL elicitation - opens feedback form in browser
52-
53-
## Available Resources
54-
55-
- **about://server**: Server information
56-
- **doc://example**: Sample markdown document
57-
- **greeting://{name}**: Personalized greeting template
58-
- **item://{id}**: Item data by ID
59-
60-
## Available Prompts
61-
62-
- **greeting**: Generates a personalized greeting
63-
- **code_review**: Structured code review prompt
64-
6535
## Recommended Workflows
6636
67-
1. **Testing Connection**: Call `hello` with your name to verify the server is responding
68-
2. **Weather Demo**: Call `get_weather` with a location to see structured output
69-
3. **Progress Demo**: Call `long_task` to see progress notifications
70-
4. **Dynamic Loading**: Call `load_bonus_tool`, then refresh tools to see `bonus_calculator`
71-
5. **Elicitation Demo**: Call `confirm_action` to see user confirmation flow
72-
6. **URL Elicitation**: Call `get_feedback` to open a feedback form
37+
1. **Test connectivity** → Call `hello` to verify the server responds
38+
2. **Structured output** → Call `get_weather` to see typed response data
39+
3. **Progress reporting** → Call `long_task` to observe real-time progress notifications
40+
4. **Dynamic tools** → Call `load_bonus_tool`, then re-list tools to see `bonus_calculator` appear
41+
5. **LLM sampling** → Call `ask_llm` to have the server request a completion from the client
42+
6. **Elicitation** → Call `confirm_action` (form-based) or `get_feedback` (URL-based) to request user input
43+
44+
## Multi-Tool Flows
7345
74-
## Tool Annotations
46+
- **Full demo**: `hello` → `get_weather` → `long_task` → `load_bonus_tool` → `bonus_calculator`
47+
- **Dynamic loading**: `load_bonus_tool` triggers a `tools/list_changed` notification — refresh your tool list to see `bonus_calculator`
48+
- **User interaction**: `confirm_action` demonstrates schema elicitation, `get_feedback` demonstrates URL elicitation
7549
76-
All tools include annotations indicating:
77-
- Whether they modify state (readOnlyHint)
78-
- If they're safe to retry (idempotentHint)
79-
- Whether they access external systems (openWorldHint)
50+
## Notes
8051
81-
Use these hints to make informed decisions about tool usage.
52+
- All tools include annotations (readOnlyHint, idempotentHint, openWorldHint) to guide safe usage
53+
- Resources and prompts are available for context and templating — use `resources/list` and `prompts/list` to discover them
8254
""".strip()
8355

8456
# Initialize FastMCP server with instructions
8557
mcp = FastMCP(
8658
"mcp-python-starter",
8759
instructions=SERVER_INSTRUCTIONS,
8860
)
61+
mcp._mcp_server.version = "1.0.0"
8962

9063
# Enable listChanged notifications for dynamic tool loading (load_bonus_tool).
9164
# FastMCP calls create_initialization_options() without args, which defaults to

0 commit comments

Comments
 (0)