Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions docs/legacy/concepts/sampling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ Sampling requests use a standardized message format:
{
role: "user" | "assistant",
content: {
type: "text" | "image",
type: "text" | "image" | "audio" | "resource" | "resource_link",

// For text:
text?: string,

// For images:
// For images/audio:
data?: string, // base64 encoded
mimeType?: string
mimeType?: string,

// For resources:
resource?: {
uri: string,
mimeType: string,
text?: string, // for text resources
blob?: string // for blob resources, base64 encoded
}
}
}
],
Expand Down Expand Up @@ -70,7 +78,9 @@ The `messages` array contains the conversation history to send to the LLM. Each
- `role`: Either "user" or "assistant"
- `content`: The message content, which can be:
- Text content with a `text` field
- Image content with `data` (base64) and `mimeType` fields
- Image/audio content with `data` (base64) and `mimeType` fields
- An embedded [resource](/docs/concepts/resources)
- A [resource](/docs/concepts/resources) link

### Model preferences

Expand Down
36 changes: 36 additions & 0 deletions docs/specification/draft/client/sampling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,42 @@ Sampling messages can contain:
}
```

#### Resource Links

A tool **MAY** return links to [Resources](/specification/draft/server/resources), to provide additional context
or data. In this case, the tool will return a URI that can be subscribed to or fetched by the client:

```json
{
"type": "resource_link",
"uri": "file:///project/src/main.rs",
"name": "main.rs",
"description": "Primary application entry point",
"mimeType": "text/x-rust"
}
```

<Info>
Resource links returned by tools are not guaranteed to appear in the results
of a `resources/list` request.
</Info>

#### Embedded Resources

[Resources](/specification/draft/server/resources) **MAY** be embedded to provide additional context
or data using a suitable [URI scheme](../server/resources#common-uri-schemes). Servers that use embedded resources **SHOULD** implement the `resources` capability:

```json
{
"type": "resource",
"resource": {
"uri": "file:///project/src/main.rs",
"mimeType": "text/x-rust",
"text": "fn main() {\n println!(\"Hello world!\");\n}"
}
}
```

### Model Preferences

Model selection in MCP requires careful abstraction since servers and clients may use
Expand Down
4 changes: 2 additions & 2 deletions docs/specification/draft/schema.mdx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 2 additions & 22 deletions schema/draft/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion schema/draft/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ export interface CreateMessageResult extends Result, SamplingMessage {
*/
export interface SamplingMessage {
role: Role;
content: TextContent | ImageContent | AudioContent;
content: ContentBlock;
}

/**
Expand Down