Skip to content

Commit d5a1d08

Browse files
Remove "Full example" links from README.v2.md
The links to snippet source files are redundant since the code blocks already contain the entire source. Removes all 33 occurrences.
1 parent c0e1559 commit d5a1d08

File tree

1 file changed

+0
-66
lines changed

1 file changed

+0
-66
lines changed

README.v2.md

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,6 @@ if __name__ == "__main__":
183183
```
184184
<!-- /snippet-source -->
185185

186-
_Full example: [examples/snippets/servers/mcpserver_quickstart.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/mcpserver_quickstart.py)_
187-
188186
You can install this server in [Claude Code](https://docs.claude.com/en/docs/claude-code/mcp) and interact with it right away. First, run the server:
189187

190188
```bash
@@ -281,8 +279,6 @@ def query_db(ctx: Context[AppContext]) -> str:
281279
```
282280
<!-- /snippet-source -->
283281

284-
_Full example: [examples/snippets/servers/lifespan_example.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lifespan_example.py)_
285-
286282
### Resources
287283

288284
Resources are how you expose data to LLMs. They're similar to GET endpoints in a REST API - they provide data but shouldn't perform significant computation or have side effects:
@@ -312,8 +308,6 @@ def get_settings() -> str:
312308
```
313309
<!-- /snippet-source -->
314310

315-
_Full example: [examples/snippets/servers/basic_resource.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/basic_resource.py)_
316-
317311
### Tools
318312

319313
Tools let LLMs take actions through your server. Unlike resources, tools are expected to perform computation and have side effects:
@@ -339,8 +333,6 @@ def get_weather(city: str, unit: str = "celsius") -> str:
339333
```
340334
<!-- /snippet-source -->
341335

342-
_Full example: [examples/snippets/servers/basic_tool.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/basic_tool.py)_
343-
344336
Tools can optionally receive a Context object by including a parameter with the `Context` type annotation. This context is automatically injected by the MCPServer framework and provides access to MCP capabilities:
345337

346338
<!-- snippet-source examples/snippets/servers/tool_progress.py -->
@@ -369,8 +361,6 @@ async def long_running_task(task_name: str, ctx: Context[ServerSession, None], s
369361
```
370362
<!-- /snippet-source -->
371363

372-
_Full example: [examples/snippets/servers/tool_progress.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/tool_progress.py)_
373-
374364
#### Structured Output
375365

376366
Tools will return structured results by default, if their return type
@@ -454,8 +444,6 @@ def empty_result_tool() -> CallToolResult:
454444
```
455445
<!-- /snippet-source -->
456446

457-
_Full example: [examples/snippets/servers/direct_call_tool_result.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/direct_call_tool_result.py)_
458-
459447
**Important:** `CallToolResult` must always be returned (no `Optional` or `Union`). For empty results, use `CallToolResult(content=[])`. For optional simple types, use `str | None` without `CallToolResult`.
460448

461449
<!-- snippet-source examples/snippets/servers/structured_output.py -->
@@ -560,8 +548,6 @@ def get_temperature(city: str) -> float:
560548
```
561549
<!-- /snippet-source -->
562550

563-
_Full example: [examples/snippets/servers/structured_output.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/structured_output.py)_
564-
565551
### Prompts
566552

567553
Prompts are reusable templates that help LLMs interact with your server effectively:
@@ -589,8 +575,6 @@ def debug_error(error: str) -> list[base.Message]:
589575
```
590576
<!-- /snippet-source -->
591577

592-
_Full example: [examples/snippets/servers/basic_prompt.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/basic_prompt.py)_
593-
594578
### Icons
595579

596580
MCP servers can provide icons for UI display. Icons can be added to the server implementation, tools, resources, and prompts:
@@ -624,8 +608,6 @@ def my_resource():
624608
return "content"
625609
```
626610

627-
_Full example: [examples/mcpserver/icons_demo.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/mcpserver/icons_demo.py)_
628-
629611
### Images
630612

631613
MCPServer provides an `Image` class that automatically handles image data:
@@ -650,8 +632,6 @@ def create_thumbnail(image_path: str) -> Image:
650632
```
651633
<!-- /snippet-source -->
652634

653-
_Full example: [examples/snippets/servers/images.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/images.py)_
654-
655635
### Context
656636

657637
The Context object is automatically injected into tool and resource functions that request it via type hints. It provides access to MCP capabilities like logging, progress reporting, resource reading, user interaction, and request metadata.
@@ -717,8 +697,6 @@ async def long_running_task(task_name: str, ctx: Context[ServerSession, None], s
717697
```
718698
<!-- /snippet-source -->
719699

720-
_Full example: [examples/snippets/servers/tool_progress.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/tool_progress.py)_
721-
722700
### Completions
723701

724702
MCP supports providing completion suggestions for prompt arguments and resource template parameters. With the context parameter, servers can provide completions based on previously resolved values:
@@ -807,8 +785,6 @@ if __name__ == "__main__":
807785
```
808786
<!-- /snippet-source -->
809787

810-
_Full example: [examples/snippets/clients/completion_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/completion_client.py)_
811-
812788
### Elicitation
813789

814790
Request additional information from users. This example shows an Elicitation during a Tool Call:
@@ -917,8 +893,6 @@ async def connect_service(service_name: str, ctx: Context[ServerSession, None])
917893
```
918894
<!-- /snippet-source -->
919895

920-
_Full example: [examples/snippets/servers/elicitation.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/elicitation.py)_
921-
922896
Elicitation schemas support default values for all field types. Default values are automatically included in the JSON schema sent to clients, allowing them to pre-populate forms.
923897

924898
The `elicit()` method returns an `ElicitationResult` with:
@@ -962,8 +936,6 @@ async def generate_poem(topic: str, ctx: Context[ServerSession, None]) -> str:
962936
```
963937
<!-- /snippet-source -->
964938

965-
_Full example: [examples/snippets/servers/sampling.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/sampling.py)_
966-
967939
### Logging and Notifications
968940

969941
Tools can send logs and notifications through the context:
@@ -992,8 +964,6 @@ async def process_data(data: str, ctx: Context[ServerSession, None]) -> str:
992964
```
993965
<!-- /snippet-source -->
994966

995-
_Full example: [examples/snippets/servers/notifications.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/notifications.py)_
996-
997967
### Authentication
998968

999969
Authentication can be used by servers that want to expose tools accessing protected resources.
@@ -1052,8 +1022,6 @@ if __name__ == "__main__":
10521022
```
10531023
<!-- /snippet-source -->
10541024

1055-
_Full example: [examples/snippets/servers/oauth_server.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/oauth_server.py)_
1056-
10571025
For a complete example with separate Authorization Server and Resource Server implementations, see [`examples/servers/simple-auth/`](examples/servers/simple-auth/).
10581026

10591027
**Architecture:**
@@ -1226,8 +1194,6 @@ if __name__ == "__main__":
12261194
```
12271195
<!-- /snippet-source -->
12281196

1229-
_Full example: [examples/snippets/servers/direct_execution.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/direct_execution.py)_
1230-
12311197
Run it with:
12321198

12331199
```bash
@@ -1275,8 +1241,6 @@ if __name__ == "__main__":
12751241
```
12761242
<!-- /snippet-source -->
12771243

1278-
_Full example: [examples/snippets/servers/streamable_config.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_config.py)_
1279-
12801244
You can mount multiple MCPServer servers in a Starlette application:
12811245

12821246
<!-- snippet-source examples/snippets/servers/streamable_starlette_mount.py -->
@@ -1337,8 +1301,6 @@ app = Starlette(
13371301
```
13381302
<!-- /snippet-source -->
13391303

1340-
_Full example: [examples/snippets/servers/streamable_starlette_mount.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_starlette_mount.py)_
1341-
13421304
For low level server with Streamable HTTP implementations, see:
13431305

13441306
- Stateful server: [`examples/servers/simple-streamablehttp/`](examples/servers/simple-streamablehttp/)
@@ -1432,8 +1394,6 @@ app = Starlette(
14321394
```
14331395
<!-- /snippet-source -->
14341396

1435-
_Full example: [examples/snippets/servers/streamable_http_basic_mounting.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_http_basic_mounting.py)_
1436-
14371397
##### Host-based routing
14381398

14391399
<!-- snippet-source examples/snippets/servers/streamable_http_host_mounting.py -->
@@ -1479,8 +1439,6 @@ app = Starlette(
14791439
```
14801440
<!-- /snippet-source -->
14811441

1482-
_Full example: [examples/snippets/servers/streamable_http_host_mounting.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_http_host_mounting.py)_
1483-
14841442
##### Multiple servers with path configuration
14851443

14861444
<!-- snippet-source examples/snippets/servers/streamable_http_multiple_servers.py -->
@@ -1536,8 +1494,6 @@ app = Starlette(
15361494
```
15371495
<!-- /snippet-source -->
15381496

1539-
_Full example: [examples/snippets/servers/streamable_http_multiple_servers.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_http_multiple_servers.py)_
1540-
15411497
##### Path configuration at initialization
15421498

15431499
<!-- snippet-source examples/snippets/servers/streamable_http_path_config.py -->
@@ -1576,8 +1532,6 @@ app = Starlette(
15761532
```
15771533
<!-- /snippet-source -->
15781534

1579-
_Full example: [examples/snippets/servers/streamable_http_path_config.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/streamable_http_path_config.py)_
1580-
15811535
#### SSE servers
15821536

15831537
> **Note**: SSE transport is being superseded by [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http).
@@ -1741,8 +1695,6 @@ if __name__ == "__main__":
17411695
```
17421696
<!-- /snippet-source -->
17431697

1744-
_Full example: [examples/snippets/servers/lowlevel/lifespan.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lowlevel/lifespan.py)_
1745-
17461698
The lifespan API provides:
17471699

17481700
- A way to initialize resources when the server starts and clean them up when it stops
@@ -1817,8 +1769,6 @@ if __name__ == "__main__":
18171769
```
18181770
<!-- /snippet-source -->
18191771

1820-
_Full example: [examples/snippets/servers/lowlevel/basic.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lowlevel/basic.py)_
1821-
18221772
Caution: The `uv run mcp run` and `uv run mcp dev` tool doesn't support low-level server.
18231773

18241774
#### Structured Output Support
@@ -1910,8 +1860,6 @@ if __name__ == "__main__":
19101860
```
19111861
<!-- /snippet-source -->
19121862

1913-
_Full example: [examples/snippets/servers/lowlevel/structured_output.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lowlevel/structured_output.py)_
1914-
19151863
With the low-level server, handlers always return `CallToolResult` directly. You construct both the human-readable `content` and the machine-readable `structured_content` yourself, giving you full control over the response.
19161864

19171865
##### Returning CallToolResult with `_meta`
@@ -1985,8 +1933,6 @@ if __name__ == "__main__":
19851933
```
19861934
<!-- /snippet-source -->
19871935

1988-
_Full example: [examples/snippets/servers/lowlevel/direct_call_tool_result.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lowlevel/direct_call_tool_result.py)_
1989-
19901936
### Pagination (Advanced)
19911937

19921938
For servers that need to handle large datasets, the low-level server provides paginated versions of list operations. This is an optional optimization - most servers won't need pagination unless they're dealing with hundreds or thousands of items.
@@ -2033,8 +1979,6 @@ server = Server("paginated-server", on_list_resources=handle_list_resources)
20331979
```
20341980
<!-- /snippet-source -->
20351981

2036-
_Full example: [examples/snippets/servers/pagination_example.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/pagination_example.py)_
2037-
20381982
#### Client-side Consumption
20391983

20401984
<!-- snippet-source examples/snippets/clients/pagination_client.py -->
@@ -2081,8 +2025,6 @@ if __name__ == "__main__":
20812025
```
20822026
<!-- /snippet-source -->
20832027

2084-
_Full example: [examples/snippets/clients/pagination_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/pagination_client.py)_
2085-
20862028
#### Key Points
20872029

20882030
- **Cursors are opaque strings** - the server defines the format (numeric offsets, timestamps, etc.)
@@ -2181,8 +2123,6 @@ if __name__ == "__main__":
21812123
```
21822124
<!-- /snippet-source -->
21832125

2184-
_Full example: [examples/snippets/clients/stdio_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/stdio_client.py)_
2185-
21862126
Clients can also connect using [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http):
21872127

21882128
<!-- snippet-source examples/snippets/clients/streamable_basic.py -->
@@ -2214,8 +2154,6 @@ if __name__ == "__main__":
22142154
```
22152155
<!-- /snippet-source -->
22162156

2217-
_Full example: [examples/snippets/clients/streamable_basic.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/streamable_basic.py)_
2218-
22192157
### Client Display Utilities
22202158

22212159
When building MCP clients, the SDK provides utilities to help display human-readable names for tools, resources, and prompts:
@@ -2291,8 +2229,6 @@ if __name__ == "__main__":
22912229
```
22922230
<!-- /snippet-source -->
22932231

2294-
_Full example: [examples/snippets/clients/display_utilities.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/display_utilities.py)_
2295-
22962232
The `get_display_name()` function implements the proper precedence rules for displaying names:
22972233

22982234
- For tools: `title` > `annotations.title` > `name`
@@ -2397,8 +2333,6 @@ if __name__ == "__main__":
23972333
```
23982334
<!-- /snippet-source -->
23992335

2400-
_Full example: [examples/snippets/clients/oauth_client.py](https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/clients/oauth_client.py)_
2401-
24022336
For a complete working example, see [`examples/clients/simple-auth-client/`](examples/clients/simple-auth-client/).
24032337

24042338
### Parsing Tool Results

0 commit comments

Comments
 (0)