Skip to content

Commit 81e1d0a

Browse files
Add reference docs for MCP Resources (#900)
* Add reference docs for MCP Resources * 🤖 Regenerate LLMs.txt --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 40e0a66 commit 81e1d0a

4 files changed

Lines changed: 405 additions & 1 deletion

File tree

app/en/references/mcp/python/_meta.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ const meta: MetaRecord = {
1515
context: {
1616
title: "Context",
1717
},
18+
resources: {
19+
title: "Resources",
20+
},
1821
server: {
1922
title: "Server",
2023
},

app/en/references/mcp/python/page.mdx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,46 @@ Decorator for registering tools. Can be used with or without arguments.
118118
| `requires_metadata` | `list[str] \| None` | List of metadata keys the tool requires | `None` |
119119
| `adapters` | `list[ErrorAdapter] \| None` | Error adapters for custom error handling | `None` |
120120
| `metadata` | `ToolMetadata \| None` | Additional tool metadata | `None` |
121+
| `meta` | `dict[str, Any] \| None` | Arbitrary `_meta` extensions (e.g., `{"ui": {"resourceUri": "..."}}`) | `None` |
122+
123+
#### `resource`
124+
125+
```python
126+
@app.resource(
127+
"config://settings",
128+
name="Settings",
129+
description="Application settings",
130+
mime_type="application/json",
131+
)
132+
def settings_handler(uri: str) -> str:
133+
...
134+
```
135+
136+
Decorator for registering resources and resource templates. See [Resources](/references/mcp/python/resources) for full documentation.
137+
138+
#### `add_resource`
139+
140+
```python
141+
app.add_resource(uri, name=None, handler=my_handler, ...)
142+
```
143+
144+
Imperative form of `@app.resource`. See [Resources](/references/mcp/python/resources) for full documentation.
145+
146+
#### `add_text_resource`
147+
148+
```python
149+
app.add_text_resource(uri, text="...", name=None, ...)
150+
```
151+
152+
Register a static text resource. See [Resources](/references/mcp/python/resources) for full documentation.
153+
154+
#### `add_file_resource`
155+
156+
```python
157+
app.add_file_resource(uri, path="path/to/file", name=None, ...)
158+
```
159+
160+
Register a file-backed resource. See [Resources](/references/mcp/python/resources) for full documentation.
121161

122162
#### `add_tool`
123163

0 commit comments

Comments
 (0)