Skip to content

Commit a9c679b

Browse files
committed
Copy InputRequests/InputResponses types from main repo
1 parent ccd6a8e commit a9c679b

2 files changed

Lines changed: 79 additions & 148 deletions

File tree

‎schema/draft/schema.json‎

Lines changed: 53 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -366,24 +366,11 @@
366366
"type": "string"
367367
},
368368
"additionalProperties": {
369-
"type": "object",
370-
"properties": {
371-
"method": {
372-
"type": "string"
373-
},
374-
"params": {
375-
"type": "object",
376-
"propertyNames": {
377-
"type": "string"
378-
},
379-
"additionalProperties": {}
380-
}
381-
},
382-
"required": [
383-
"method",
384-
"params"
385-
],
386-
"additionalProperties": false
369+
"anyOf": [
370+
{},
371+
{},
372+
{}
373+
]
387374
}
388375
}
389376
},
@@ -758,24 +745,11 @@
758745
"type": "string"
759746
},
760747
"additionalProperties": {
761-
"type": "object",
762-
"properties": {
763-
"method": {
764-
"type": "string"
765-
},
766-
"params": {
767-
"type": "object",
768-
"propertyNames": {
769-
"type": "string"
770-
},
771-
"additionalProperties": {}
772-
}
773-
},
774-
"required": [
775-
"method",
776-
"params"
777-
],
778-
"additionalProperties": false
748+
"anyOf": [
749+
{},
750+
{},
751+
{}
752+
]
779753
}
780754
}
781755
},
@@ -937,24 +911,11 @@
937911
},
938912
"InputRequest": {
939913
"$schema": "https://json-schema.org/draft/2020-12/schema",
940-
"type": "object",
941-
"properties": {
942-
"method": {
943-
"type": "string"
944-
},
945-
"params": {
946-
"type": "object",
947-
"propertyNames": {
948-
"type": "string"
949-
},
950-
"additionalProperties": {}
951-
}
952-
},
953-
"required": [
954-
"method",
955-
"params"
956-
],
957-
"additionalProperties": false
914+
"anyOf": [
915+
{},
916+
{},
917+
{}
918+
]
958919
},
959920
"InputRequests": {
960921
"$schema": "https://json-schema.org/draft/2020-12/schema",
@@ -963,24 +924,11 @@
963924
"type": "string"
964925
},
965926
"additionalProperties": {
966-
"type": "object",
967-
"properties": {
968-
"method": {
969-
"type": "string"
970-
},
971-
"params": {
972-
"type": "object",
973-
"propertyNames": {
974-
"type": "string"
975-
},
976-
"additionalProperties": {}
977-
}
978-
},
979-
"required": [
980-
"method",
981-
"params"
982-
],
983-
"additionalProperties": false
927+
"anyOf": [
928+
{},
929+
{},
930+
{}
931+
]
984932
}
985933
},
986934
"InputRequiredTask": {
@@ -1022,24 +970,11 @@
1022970
"type": "string"
1023971
},
1024972
"additionalProperties": {
1025-
"type": "object",
1026-
"properties": {
1027-
"method": {
1028-
"type": "string"
1029-
},
1030-
"params": {
1031-
"type": "object",
1032-
"propertyNames": {
1033-
"type": "string"
1034-
},
1035-
"additionalProperties": {}
1036-
}
1037-
},
1038-
"required": [
1039-
"method",
1040-
"params"
1041-
],
1042-
"additionalProperties": false
973+
"anyOf": [
974+
{},
975+
{},
976+
{}
977+
]
1043978
}
1044979
}
1045980
},
@@ -1053,18 +988,26 @@
1053988
],
1054989
"additionalProperties": false
1055990
},
991+
"InputResponse": {
992+
"$schema": "https://json-schema.org/draft/2020-12/schema",
993+
"anyOf": [
994+
{},
995+
{},
996+
{}
997+
]
998+
},
1056999
"InputResponses": {
10571000
"$schema": "https://json-schema.org/draft/2020-12/schema",
10581001
"type": "object",
10591002
"propertyNames": {
10601003
"type": "string"
10611004
},
10621005
"additionalProperties": {
1063-
"type": "object",
1064-
"propertyNames": {
1065-
"type": "string"
1066-
},
1067-
"additionalProperties": {}
1006+
"anyOf": [
1007+
{},
1008+
{},
1009+
{}
1010+
]
10681011
}
10691012
},
10701013
"Task": {
@@ -1228,24 +1171,11 @@
12281171
"type": "string"
12291172
},
12301173
"additionalProperties": {
1231-
"type": "object",
1232-
"properties": {
1233-
"method": {
1234-
"type": "string"
1235-
},
1236-
"params": {
1237-
"type": "object",
1238-
"propertyNames": {
1239-
"type": "string"
1240-
},
1241-
"additionalProperties": {}
1242-
}
1243-
},
1244-
"required": [
1245-
"method",
1246-
"params"
1247-
],
1248-
"additionalProperties": false
1174+
"anyOf": [
1175+
{},
1176+
{},
1177+
{}
1178+
]
12491179
}
12501180
}
12511181
},
@@ -1521,24 +1451,11 @@
15211451
"type": "string"
15221452
},
15231453
"additionalProperties": {
1524-
"type": "object",
1525-
"properties": {
1526-
"method": {
1527-
"type": "string"
1528-
},
1529-
"params": {
1530-
"type": "object",
1531-
"propertyNames": {
1532-
"type": "string"
1533-
},
1534-
"additionalProperties": {}
1535-
}
1536-
},
1537-
"required": [
1538-
"method",
1539-
"params"
1540-
],
1541-
"additionalProperties": false
1454+
"anyOf": [
1455+
{},
1456+
{},
1457+
{}
1458+
]
15421459
}
15431460
}
15441461
},
@@ -1810,11 +1727,11 @@
18101727
"type": "string"
18111728
},
18121729
"additionalProperties": {
1813-
"type": "object",
1814-
"propertyNames": {
1815-
"type": "string"
1816-
},
1817-
"additionalProperties": {}
1730+
"anyOf": [
1731+
{},
1732+
{},
1733+
{}
1734+
]
18181735
}
18191736
}
18201737
},

‎schema/draft/schema.ts‎

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@
1212
*/
1313

1414
import type {
15+
CreateMessageRequest,
16+
CreateMessageResult,
17+
ElicitRequest,
18+
ElicitResult,
1519
JSONRPCNotification,
1620
JSONRPCRequest,
21+
ListRootsRequest,
22+
ListRootsResult,
1723
NotificationParams,
1824
Result,
1925
} from "@modelcontextprotocol/sdk/types.js";
@@ -103,17 +109,21 @@ export interface WorkingTask extends Task {
103109
* @category `tasks`
104110
*/
105111
// TODO: Import from SDK once updated for MRTR
106-
export interface InputRequest {
107-
/**
108-
* The JSON-RPC method for the server-to-client request.
109-
*/
110-
method: string;
112+
export type InputRequest =
113+
| CreateMessageRequest
114+
| ListRootsRequest
115+
| ElicitRequest;
111116

112-
/**
113-
* Parameters for the server-to-client request.
114-
*/
115-
params: { [key: string]: unknown };
116-
}
117+
/**
118+
* A single input response from the client to the server during task execution.
119+
*
120+
* @category `tasks`
121+
*/
122+
// TODO: Import from SDK once updated for MRTR
123+
export type InputResponse =
124+
| CreateMessageResult
125+
| ListRootsResult
126+
| ElicitResult;
117127

118128
/**
119129
* Outstanding server-to-client requests that need to be fulfilled during task execution.
@@ -123,7 +133,9 @@ export interface InputRequest {
123133
* @category `tasks`
124134
*/
125135
// TODO: Import from SDK once updated for MRTR
126-
export type InputRequests = Record<string, InputRequest>;
136+
export interface InputRequests {
137+
[key: string]: InputRequest;
138+
}
127139

128140
/**
129141
* Client responses to outstanding input requests. Each key MUST correspond to a
@@ -132,7 +144,9 @@ export type InputRequests = Record<string, InputRequest>;
132144
* @category `tasks`
133145
*/
134146
// TODO: Import from SDK once updated for MRTR
135-
export type InputResponses = Record<string, { [key: string]: unknown }>;
147+
export interface InputResponses {
148+
[key: string]: InputResponse;
149+
}
136150

137151
/**
138152
* A task that is waiting for input from the client.

0 commit comments

Comments
 (0)