Skip to content

Commit 7e89e60

Browse files
committed
Make basic documentation changes for resource support in sampling
1 parent ef72f8a commit 7e89e60

File tree

3 files changed

+29
-94
lines changed

3 files changed

+29
-94
lines changed

docs/docs/concepts/sampling.mdx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,22 @@ Sampling requests use a standardized message format:
3333
{
3434
role: "user" | "assistant",
3535
content: {
36-
type: "text" | "image",
36+
type: "text" | "image" | "audio" | "resource",
3737

3838
// For text:
3939
text?: string,
4040

41-
// For images:
41+
// For images/audio:
4242
data?: string, // base64 encoded
43-
mimeType?: string
43+
mimeType?: string,
44+
45+
// For resources:
46+
resource?: {
47+
uri: string,
48+
mimeType: string,
49+
text?: string, // for text resources
50+
blob?: string // for blob resources, base64 encoded
51+
}
4452
}
4553
}
4654
],
@@ -70,7 +78,8 @@ The `messages` array contains the conversation history to send to the LLM. Each
7078
- `role`: Either "user" or "assistant"
7179
- `content`: The message content, which can be:
7280
- Text content with a `text` field
73-
- Image content with `data` (base64) and `mimeType` fields
81+
- Image/audio content with `data` (base64) and `mimeType` fields
82+
- An embedded [resource](/docs/concepts/resources)
7483

7584
### Model preferences
7685

schema/draft/schema.json

Lines changed: 5 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/draft/schema.ts

Lines changed: 11 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -685,66 +685,31 @@ export interface ListToolsResult extends PaginatedResult {
685685

686686
/**
687687
* The server's response to a tool call.
688-
*
689-
* Any errors that originate from the tool SHOULD be reported inside the result
690-
* object, with `isError` set to true, _not_ as an MCP protocol-level error
691-
* response. Otherwise, the LLM would not be able to see that an error occurred
692-
* and self-correct.
693-
*
694-
* However, any errors in _finding_ the tool, an error indicating that the
695-
* server does not support tool calls, or any other exceptional conditions,
696-
* should be reported as an MCP error response.
697-
*/
698-
export type CallToolResult =
699-
| CallToolUnstructuredResult
700-
| CallToolStructuredResult;
701-
702-
/**
703-
* Tool result for tools that do not declare an outputSchema.
704688
*/
705-
export interface CallToolUnstructuredResult extends Result {
689+
export interface CallToolResult extends Result {
706690
/**
707-
* A list of content objects that represent the result of the tool call.
708-
*
709-
* If the Tool does not define an outputSchema, this field MUST be present in the result.
691+
* A list of content objects that represent the unstructured result of the tool call.
710692
*/
711693
content: ContentBlock[];
712694

713695
/**
714-
* Structured output must not be provided in an unstructured tool result.
696+
* An optional JSON object that represents the structured result of the tool call.
715697
*/
716-
structuredContent: never;
698+
structuredContent?: { [key: string]: unknown };
717699

718700
/**
719701
* Whether the tool call ended in an error.
720702
*
721703
* If not set, this is assumed to be false (the call was successful).
722-
*/
723-
isError?: boolean;
724-
}
725-
726-
/**
727-
* Tool result for tools that do declare an outputSchema.
728-
*/
729-
export interface CallToolStructuredResult extends Result {
730-
/**
731-
* An object containing structured tool output.
732704
*
733-
* If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema.
734-
*/
735-
structuredContent: { [key: string]: unknown };
736-
737-
/**
738-
* If the Tool defines an outputSchema, this field MAY be present in the result.
739-
* Tools should use this field to provide compatibility with older clients that do not support structured content.
740-
* Clients that support structured content should ignore this field.
741-
*/
742-
content?: ContentBlock[];
743-
744-
/**
745-
* Whether the tool call ended in an error.
705+
* Any errors that originate from the tool SHOULD be reported inside the result
706+
* object, with `isError` set to true, _not_ as an MCP protocol-level error
707+
* response. Otherwise, the LLM would not be able to see that an error occurred
708+
* and self-correct.
746709
*
747-
* If not set, this is assumed to be false (the call was successful).
710+
* However, any errors in _finding_ the tool, an error indicating that the
711+
* server does not support tool calls, or any other exceptional conditions,
712+
* should be reported as an MCP error response.
748713
*/
749714
isError?: boolean;
750715
}

0 commit comments

Comments
 (0)