Skip to content

Commit 6747d28

Browse files
committed
Add "type": "resource" key
1 parent 685198f commit 6747d28

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

docs/spec/prompts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ Example:
253253
{
254254
"role": "user",
255255
"content": {
256+
"type": "resource",
256257
"uri": "file:///workspace/project/requirements.txt",
257258
"mimeType": "text/plain",
258259
"text": "flask==2.0.1\nnumpy==1.21.0\npandas==1.3.0\n"

schema/schema.json

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,18 +1167,18 @@
11671167
"type": "object"
11681168
},
11691169
"PromptMessage": {
1170-
"description": "Describes a message returned as part of a prompt.\n\nThis is similar to `SamplingMessage`, but also supports the embedding of\nresource contents from the MCP server. The client MUST decide how to render\nembedded resources for the benefit of the LLM and/or the user.",
1170+
"description": "Describes a message returned as part of a prompt.\n\nThis is similar to `SamplingMessage`, but also supports the embedding of\nresource contents from the MCP server.",
11711171
"properties": {
11721172
"content": {
11731173
"anyOf": [
1174-
{
1175-
"$ref": "#/definitions/ResourceContents"
1176-
},
11771174
{
11781175
"$ref": "#/definitions/TextContent"
11791176
},
11801177
{
11811178
"$ref": "#/definitions/ImageContent"
1179+
},
1180+
{
1181+
"$ref": "#/definitions/PromptResourceContents"
11821182
}
11831183
]
11841184
},
@@ -1214,6 +1214,29 @@
12141214
],
12151215
"type": "object"
12161216
},
1217+
"PromptResourceContents": {
1218+
"description": "The contents of a resource, embedded into a prompt.\n\nIt is up to the client how best to render embedded resources for the benefit\nof the LLM and/or the user.",
1219+
"properties": {
1220+
"mimeType": {
1221+
"description": "The MIME type of this resource, if known.",
1222+
"type": "string"
1223+
},
1224+
"type": {
1225+
"const": "resource",
1226+
"type": "string"
1227+
},
1228+
"uri": {
1229+
"description": "The URI of this resource.",
1230+
"format": "uri",
1231+
"type": "string"
1232+
}
1233+
},
1234+
"required": [
1235+
"type",
1236+
"uri"
1237+
],
1238+
"type": "object"
1239+
},
12171240
"ReadResourceRequest": {
12181241
"description": "Sent from the client to the server, to read a specific resource URI.",
12191242
"properties": {

schema/schema.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,12 +558,21 @@ export interface PromptArgument {
558558
* Describes a message returned as part of a prompt.
559559
*
560560
* This is similar to `SamplingMessage`, but also supports the embedding of
561-
* resource contents from the MCP server. The client MUST decide how to render
562-
* embedded resources for the benefit of the LLM and/or the user.
561+
* resource contents from the MCP server.
563562
*/
564563
export interface PromptMessage {
565564
role: "user" | "assistant";
566-
content: TextContent | ImageContent | ResourceContents;
565+
content: TextContent | ImageContent | PromptResourceContents;
566+
}
567+
568+
/**
569+
* The contents of a resource, embedded into a prompt.
570+
*
571+
* It is up to the client how best to render embedded resources for the benefit
572+
* of the LLM and/or the user.
573+
*/
574+
export interface PromptResourceContents extends ResourceContents {
575+
type: "resource";
567576
}
568577

569578
/**

0 commit comments

Comments
 (0)