|
32 | 32 |
|
33 | 33 | A demonstration MCP server showcasing Python/FastMCP capabilities. |
34 | 34 |
|
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 | | -
|
65 | 35 | ## Recommended Workflows |
66 | 36 |
|
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 |
73 | 45 |
|
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 |
75 | 49 |
|
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 |
80 | 51 |
|
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 |
82 | 54 | """.strip() |
83 | 55 |
|
84 | 56 | # Initialize FastMCP server with instructions |
85 | 57 | mcp = FastMCP( |
86 | 58 | "mcp-python-starter", |
87 | 59 | instructions=SERVER_INSTRUCTIONS, |
88 | 60 | ) |
| 61 | +mcp._mcp_server.version = "1.0.0" |
89 | 62 |
|
90 | 63 | # Enable listChanged notifications for dynamic tool loading (load_bonus_tool). |
91 | 64 | # FastMCP calls create_initialization_options() without args, which defaults to |
|
0 commit comments