Skip to content

Commit b1769a3

Browse files
committed
Include resource links in sampling spec
1 parent 5d7c115 commit b1769a3

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

docs/legacy/concepts/sampling.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Sampling requests use a standardized message format:
3333
{
3434
role: "user" | "assistant",
3535
content: {
36-
type: "text" | "image" | "audio" | "resource",
36+
type: "text" | "image" | "audio" | "resource" | "resource_link",
3737

3838
// For text:
3939
text?: string,
@@ -80,6 +80,7 @@ The `messages` array contains the conversation history to send to the LLM. Each
8080
- Text content with a `text` field
8181
- Image/audio content with `data` (base64) and `mimeType` fields
8282
- An embedded [resource](/docs/concepts/resources)
83+
- A [resource](/docs/concepts/resources) link
8384

8485
### Model preferences
8586

docs/specification/draft/client/sampling.mdx

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,18 +167,38 @@ Sampling messages can contain:
167167
}
168168
```
169169

170+
#### Resource Links
171+
172+
A tool **MAY** return links to [Resources](/specification/draft/server/resources), to provide additional context
173+
or data. In this case, the tool will return a URI that can be subscribed to or fetched by the client:
174+
175+
```json
176+
{
177+
"type": "resource_link",
178+
"uri": "file:///project/src/main.rs",
179+
"name": "main.rs",
180+
"description": "Primary application entry point",
181+
"mimeType": "text/x-rust"
182+
}
183+
```
184+
185+
<Info>
186+
Resource links returned by tools are not guaranteed to appear in the results
187+
of a `resources/list` request.
188+
</Info>
189+
170190
#### Embedded Resources
171191

172-
[Resources](/specification/draft/server/resources) **MAY** be embedded, to provide additional context
173-
or data, behind a URI that can be subscribed to or fetched again by the client later:
192+
[Resources](/specification/draft/server/resources) **MAY** be embedded to provide additional context
193+
or data using a suitable [URI scheme](./resources#common-uri-schemes). Servers that use embedded resources **SHOULD** implement the `resources` capability:
174194

175195
```json
176196
{
177197
"type": "resource",
178198
"resource": {
179-
"uri": "resource://example",
180-
"mimeType": "text/plain",
181-
"text": "Resource content"
199+
"uri": "file:///project/src/main.rs",
200+
"mimeType": "text/x-rust",
201+
"text": "fn main() {\n println!(\"Hello world!\");\n}"
182202
}
183203
}
184204
```

0 commit comments

Comments
 (0)