-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmcp_schema.rs
More file actions
6280 lines (6280 loc) · 214 KB
/
mcp_schema.rs
File metadata and controls
6280 lines (6280 loc) · 214 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/// Copyright (c) 2025 Ali Hashemi (rust-mcp-stack)
/// Licensed under the MIT License. See LICENSE in the project root.
/// ----------------------------------------------------------------------------
/// This file is auto-generated by mcp-schema-gen v0.5.2.
/// WARNING:
/// It is not recommended to modify this file directly. You are free to
/// modify or extend the implementations as needed, but please do so at your own risk.
///
/// Generated from : <https://github.com/modelcontextprotocol/specification.git>
/// Hash : 9e7768c802b606e2d3dc4ebdaeaf07c40f943054
/// Generated at : 2026-03-12 21:06:04
/// ----------------------------------------------------------------------------
///
use super::validators as validate;
/// MCP Protocol Version
pub const LATEST_PROTOCOL_VERSION: &str = "2024-11-05";
/// JSON-RPC Version
pub const JSONRPC_VERSION: &str = "2.0";
/// Parse error. Invalid JSON was received. An error occurred while parsing the JSON text.
pub const PARSE_ERROR: i64 = -32700i64;
/// Invalid Request. The JSON sent is not a valid Request object.
pub const INVALID_REQUEST: i64 = -32600i64;
/// Method not found. The method does not exist / is not available.
pub const METHOD_NOT_FOUND: i64 = -32601i64;
/// Invalid param. Invalid method parameter(s).
pub const INVALID_PARAMS: i64 = -32602i64;
/// Internal error. Internal JSON-RPC error.
pub const INTERNAL_ERROR: i64 = -32603i64;
///Base for objects that include optional annotations for the client. The client can use annotations to inform how objects are used or displayed
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Base for objects that include optional annotations for the client. The client can use annotations to inform how objects are used or displayed",
/// "type": "object",
/// "properties": {
/// "annotations": {
/// "type": "object",
/// "properties": {
/// "audience": {
/// "description": "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., [\"user\", \"assistant\"]).",
/// "type": "array",
/// "items": {
/// "$ref": "#/definitions/Role"
/// }
/// },
/// "priority": {
/// "description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.",
/// "type": "number",
/// "maximum": 1.0,
/// "minimum": 0.0
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct Annotated {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub annotations: ::std::option::Option<AnnotatedAnnotations>,
}
///AnnotatedAnnotations
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "properties": {
/// "audience": {
/// "description": "Describes who the intended customer of this object or data is.\n\nIt can include multiple entries to indicate content useful for multiple audiences (e.g., [\"user\", \"assistant\"]).",
/// "type": "array",
/// "items": {
/// "$ref": "#/definitions/Role"
/// }
/// },
/// "priority": {
/// "description": "Describes how important this data is for operating the server.\n\nA value of 1 means \"most important,\" and indicates that the data is\neffectively required, while 0 means \"least important,\" and indicates that\nthe data is entirely optional.",
/// "type": "number",
/// "maximum": 1.0,
/// "minimum": 0.0
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct AnnotatedAnnotations {
/**Describes who the intended customer of this object or data is.
It can include multiple entries to indicate content useful for multiple audiences (e.g., ["user", "assistant"]).*/
#[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
pub audience: ::std::vec::Vec<Role>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub priority: ::std::option::Option<f64>,
}
///BlobResourceContents
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "blob",
/// "uri"
/// ],
/// "properties": {
/// "blob": {
/// "description": "A base64-encoded string representing the binary data of the item.",
/// "type": "string",
/// "format": "byte"
/// },
/// "mimeType": {
/// "description": "The MIME type of this resource, if known.",
/// "type": "string"
/// },
/// "uri": {
/// "description": "The URI of this resource.",
/// "type": "string",
/// "format": "uri"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct BlobResourceContents {
///A base64-encoded string representing the binary data of the item.
pub blob: ::std::string::String,
///The MIME type of this resource, if known.
#[serde(rename = "mimeType", default, skip_serializing_if = "::std::option::Option::is_none")]
pub mime_type: ::std::option::Option<::std::string::String>,
///The URI of this resource.
pub uri: ::std::string::String,
}
///Used by the client to invoke a tool provided by the server.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Used by the client to invoke a tool provided by the server.",
/// "type": "object",
/// "required": [
/// "method",
/// "params"
/// ],
/// "properties": {
/// "method": {
/// "type": "string",
/// "const": "tools/call"
/// },
/// "params": {
/// "type": "object",
/// "required": [
/// "name"
/// ],
/// "properties": {
/// "arguments": {
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "name": {
/// "type": "string"
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CallToolRequest {
#[serde(deserialize_with = "validate::call_tool_request_method")]
method: ::std::string::String,
pub params: CallToolRequestParams,
}
impl CallToolRequest {
pub fn new(params: CallToolRequestParams) -> Self {
Self {
method: "tools/call".to_string(),
params,
}
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "tools/call"
pub fn method_value() -> &'static str {
"tools/call"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"tools/call"
}
}
///CallToolRequestParams
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "name"
/// ],
/// "properties": {
/// "arguments": {
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "name": {
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CallToolRequestParams {
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub arguments: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
pub name: ::std::string::String,
}
/**The server's response to a tool call.
Any errors that originate from the tool SHOULD be reported inside the result
object, with isError set to true, _not_ as an MCP protocol-level error
response. Otherwise, the LLM would not be able to see that an error occurred
and self-correct.
However, any errors in _finding_ the tool, an error indicating that the
server does not support tool calls, or any other exceptional conditions,
should be reported as an MCP error response.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The server's response to a tool call.\n\nAny errors that originate from the tool SHOULD be reported inside the result\nobject, with isError set to true, _not_ as an MCP protocol-level error\nresponse. Otherwise, the LLM would not be able to see that an error occurred\nand self-correct.\n\nHowever, any errors in _finding_ the tool, an error indicating that the\nserver does not support tool calls, or any other exceptional conditions,\nshould be reported as an MCP error response.",
/// "type": "object",
/// "required": [
/// "content"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "content": {
/// "type": "array",
/// "items": {
/// "anyOf": [
/// {
/// "$ref": "#/definitions/TextContent"
/// },
/// {
/// "$ref": "#/definitions/ImageContent"
/// },
/// {
/// "$ref": "#/definitions/EmbeddedResource"
/// }
/// ]
/// }
/// },
/// "isError": {
/// "description": "Whether the tool call ended in an error.\n\nIf not set, this is assumed to be false (the call was successful).",
/// "type": "boolean"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CallToolResult {
pub content: ::std::vec::Vec<CallToolResultContentItem>,
/**Whether the tool call ended in an error.
If not set, this is assumed to be false (the call was successful).*/
#[serde(rename = "isError", default, skip_serializing_if = "::std::option::Option::is_none")]
pub is_error: ::std::option::Option<bool>,
///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///CallToolResultContentItem
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/definitions/TextContent"
/// },
/// {
/// "$ref": "#/definitions/ImageContent"
/// },
/// {
/// "$ref": "#/definitions/EmbeddedResource"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum CallToolResultContentItem {
TextContent(TextContent),
ImageContent(ImageContent),
EmbeddedResource(EmbeddedResource),
}
impl ::std::convert::From<TextContent> for CallToolResultContentItem {
fn from(value: TextContent) -> Self {
Self::TextContent(value)
}
}
impl ::std::convert::From<ImageContent> for CallToolResultContentItem {
fn from(value: ImageContent) -> Self {
Self::ImageContent(value)
}
}
impl ::std::convert::From<EmbeddedResource> for CallToolResultContentItem {
fn from(value: EmbeddedResource) -> Self {
Self::EmbeddedResource(value)
}
}
/**This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.
This notification indicates that the result will be unused, so any associated processing SHOULD cease.
A client MUST NOT attempt to cancel its initialize request.*/
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "This notification can be sent by either side to indicate that it is cancelling a previously-issued request.\n\nThe request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.\n\nThis notification indicates that the result will be unused, so any associated processing SHOULD cease.\n\nA client MUST NOT attempt to cancel its initialize request.",
/// "type": "object",
/// "required": [
/// "method",
/// "params"
/// ],
/// "properties": {
/// "method": {
/// "type": "string",
/// "const": "notifications/cancelled"
/// },
/// "params": {
/// "type": "object",
/// "required": [
/// "requestId"
/// ],
/// "properties": {
/// "reason": {
/// "description": "An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.",
/// "type": "string"
/// },
/// "requestId": {
/// "description": "The ID of the request to cancel.\n\nThis MUST correspond to the ID of a request previously issued in the same direction.",
/// "$ref": "#/definitions/RequestId"
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CancelledNotification {
#[serde(deserialize_with = "validate::cancelled_notification_method")]
method: ::std::string::String,
pub params: CancelledNotificationParams,
}
impl CancelledNotification {
pub fn new(params: CancelledNotificationParams) -> Self {
Self {
method: "notifications/cancelled".to_string(),
params,
}
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "notifications/cancelled"
pub fn method_value() -> &'static str {
"notifications/cancelled"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"notifications/cancelled"
}
}
///CancelledNotificationParams
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "requestId"
/// ],
/// "properties": {
/// "reason": {
/// "description": "An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.",
/// "type": "string"
/// },
/// "requestId": {
/// "description": "The ID of the request to cancel.\n\nThis MUST correspond to the ID of a request previously issued in the same direction.",
/// "$ref": "#/definitions/RequestId"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CancelledNotificationParams {
///An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub reason: ::std::option::Option<::std::string::String>,
/**The ID of the request to cancel.
This MUST correspond to the ID of a request previously issued in the same direction.*/
#[serde(rename = "requestId")]
pub request_id: RequestId,
}
///Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.",
/// "type": "object",
/// "properties": {
/// "experimental": {
/// "description": "Experimental, non-standard capabilities that the client supports.",
/// "type": "object",
/// "additionalProperties": {
/// "type": "object",
/// "additionalProperties": true
/// }
/// },
/// "roots": {
/// "description": "Present if the client supports listing roots.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether the client supports notifications for changes to the roots list.",
/// "type": "boolean"
/// }
/// }
/// },
/// "sampling": {
/// "description": "Present if the client supports sampling from an LLM.",
/// "type": "object",
/// "additionalProperties": true
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ClientCapabilities {
///Experimental, non-standard capabilities that the client supports.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub experimental: ::std::option::Option<
std::collections::BTreeMap<::std::string::String, ::serde_json::Map<::std::string::String, ::serde_json::Value>>,
>,
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub roots: ::std::option::Option<ClientRoots>,
///Present if the client supports sampling from an LLM.
#[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
pub sampling: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///ClientNotification
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/definitions/CancelledNotification"
/// },
/// {
/// "$ref": "#/definitions/InitializedNotification"
/// },
/// {
/// "$ref": "#/definitions/ProgressNotification"
/// },
/// {
/// "$ref": "#/definitions/RootsListChangedNotification"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ClientNotification {
CancelledNotification(CancelledNotification),
InitializedNotification(InitializedNotification),
ProgressNotification(ProgressNotification),
RootsListChangedNotification(RootsListChangedNotification),
}
impl ::std::convert::From<CancelledNotification> for ClientNotification {
fn from(value: CancelledNotification) -> Self {
Self::CancelledNotification(value)
}
}
impl ::std::convert::From<InitializedNotification> for ClientNotification {
fn from(value: InitializedNotification) -> Self {
Self::InitializedNotification(value)
}
}
impl ::std::convert::From<ProgressNotification> for ClientNotification {
fn from(value: ProgressNotification) -> Self {
Self::ProgressNotification(value)
}
}
impl ::std::convert::From<RootsListChangedNotification> for ClientNotification {
fn from(value: RootsListChangedNotification) -> Self {
Self::RootsListChangedNotification(value)
}
}
///ClientRequest
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/definitions/InitializeRequest"
/// },
/// {
/// "$ref": "#/definitions/PingRequest"
/// },
/// {
/// "$ref": "#/definitions/ListResourcesRequest"
/// },
/// {
/// "$ref": "#/definitions/ListResourceTemplatesRequest"
/// },
/// {
/// "$ref": "#/definitions/ReadResourceRequest"
/// },
/// {
/// "$ref": "#/definitions/SubscribeRequest"
/// },
/// {
/// "$ref": "#/definitions/UnsubscribeRequest"
/// },
/// {
/// "$ref": "#/definitions/ListPromptsRequest"
/// },
/// {
/// "$ref": "#/definitions/GetPromptRequest"
/// },
/// {
/// "$ref": "#/definitions/ListToolsRequest"
/// },
/// {
/// "$ref": "#/definitions/CallToolRequest"
/// },
/// {
/// "$ref": "#/definitions/SetLevelRequest"
/// },
/// {
/// "$ref": "#/definitions/CompleteRequest"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ClientRequest {
InitializeRequest(InitializeRequest),
PingRequest(PingRequest),
ListResourcesRequest(ListResourcesRequest),
ListResourceTemplatesRequest(ListResourceTemplatesRequest),
ReadResourceRequest(ReadResourceRequest),
SubscribeRequest(SubscribeRequest),
UnsubscribeRequest(UnsubscribeRequest),
ListPromptsRequest(ListPromptsRequest),
GetPromptRequest(GetPromptRequest),
ListToolsRequest(ListToolsRequest),
CallToolRequest(CallToolRequest),
SetLevelRequest(SetLevelRequest),
CompleteRequest(CompleteRequest),
}
impl ::std::convert::From<InitializeRequest> for ClientRequest {
fn from(value: InitializeRequest) -> Self {
Self::InitializeRequest(value)
}
}
impl ::std::convert::From<PingRequest> for ClientRequest {
fn from(value: PingRequest) -> Self {
Self::PingRequest(value)
}
}
impl ::std::convert::From<ListResourcesRequest> for ClientRequest {
fn from(value: ListResourcesRequest) -> Self {
Self::ListResourcesRequest(value)
}
}
impl ::std::convert::From<ListResourceTemplatesRequest> for ClientRequest {
fn from(value: ListResourceTemplatesRequest) -> Self {
Self::ListResourceTemplatesRequest(value)
}
}
impl ::std::convert::From<ReadResourceRequest> for ClientRequest {
fn from(value: ReadResourceRequest) -> Self {
Self::ReadResourceRequest(value)
}
}
impl ::std::convert::From<SubscribeRequest> for ClientRequest {
fn from(value: SubscribeRequest) -> Self {
Self::SubscribeRequest(value)
}
}
impl ::std::convert::From<UnsubscribeRequest> for ClientRequest {
fn from(value: UnsubscribeRequest) -> Self {
Self::UnsubscribeRequest(value)
}
}
impl ::std::convert::From<ListPromptsRequest> for ClientRequest {
fn from(value: ListPromptsRequest) -> Self {
Self::ListPromptsRequest(value)
}
}
impl ::std::convert::From<GetPromptRequest> for ClientRequest {
fn from(value: GetPromptRequest) -> Self {
Self::GetPromptRequest(value)
}
}
impl ::std::convert::From<ListToolsRequest> for ClientRequest {
fn from(value: ListToolsRequest) -> Self {
Self::ListToolsRequest(value)
}
}
impl ::std::convert::From<CallToolRequest> for ClientRequest {
fn from(value: CallToolRequest) -> Self {
Self::CallToolRequest(value)
}
}
impl ::std::convert::From<SetLevelRequest> for ClientRequest {
fn from(value: SetLevelRequest) -> Self {
Self::SetLevelRequest(value)
}
}
impl ::std::convert::From<CompleteRequest> for ClientRequest {
fn from(value: CompleteRequest) -> Self {
Self::CompleteRequest(value)
}
}
///ClientResult
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/definitions/Result"
/// },
/// {
/// "$ref": "#/definitions/CreateMessageResult"
/// },
/// {
/// "$ref": "#/definitions/ListRootsResult"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum ClientResult {
CreateMessageResult(CreateMessageResult),
ListRootsResult(ListRootsResult),
Result(Result),
}
impl ::std::convert::From<CreateMessageResult> for ClientResult {
fn from(value: CreateMessageResult) -> Self {
Self::CreateMessageResult(value)
}
}
impl ::std::convert::From<ListRootsResult> for ClientResult {
fn from(value: ListRootsResult) -> Self {
Self::ListRootsResult(value)
}
}
impl ::std::convert::From<Result> for ClientResult {
fn from(value: Result) -> Self {
Self::Result(value)
}
}
///Present if the client supports listing roots.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "Present if the client supports listing roots.",
/// "type": "object",
/// "properties": {
/// "listChanged": {
/// "description": "Whether the client supports notifications for changes to the roots list.",
/// "type": "boolean"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug, Default)]
pub struct ClientRoots {
///Whether the client supports notifications for changes to the roots list.
#[serde(rename = "listChanged", default, skip_serializing_if = "::std::option::Option::is_none")]
pub list_changed: ::std::option::Option<bool>,
}
///A request from the client to the server, to ask for completion options.
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "A request from the client to the server, to ask for completion options.",
/// "type": "object",
/// "required": [
/// "method",
/// "params"
/// ],
/// "properties": {
/// "method": {
/// "type": "string",
/// "const": "completion/complete"
/// },
/// "params": {
/// "type": "object",
/// "required": [
/// "argument",
/// "ref"
/// ],
/// "properties": {
/// "argument": {
/// "description": "The argument's information",
/// "type": "object",
/// "required": [
/// "name",
/// "value"
/// ],
/// "properties": {
/// "name": {
/// "description": "The name of the argument",
/// "type": "string"
/// },
/// "value": {
/// "description": "The value of the argument to use for completion matching.",
/// "type": "string"
/// }
/// }
/// },
/// "ref": {
/// "anyOf": [
/// {
/// "$ref": "#/definitions/PromptReference"
/// },
/// {
/// "$ref": "#/definitions/ResourceReference"
/// }
/// ]
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteRequest {
#[serde(deserialize_with = "validate::complete_request_method")]
method: ::std::string::String,
pub params: CompleteRequestParams,
}
impl CompleteRequest {
pub fn new(params: CompleteRequestParams) -> Self {
Self {
method: "completion/complete".to_string(),
params,
}
}
pub fn method(&self) -> &::std::string::String {
&self.method
}
/// returns "completion/complete"
pub fn method_value() -> &'static str {
"completion/complete"
}
#[deprecated(since = "0.8.0", note = "Use `method_value()` instead.")]
pub fn method_name() -> &'static str {
"completion/complete"
}
}
///The argument's information
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The argument's information",
/// "type": "object",
/// "required": [
/// "name",
/// "value"
/// ],
/// "properties": {
/// "name": {
/// "description": "The name of the argument",
/// "type": "string"
/// },
/// "value": {
/// "description": "The value of the argument to use for completion matching.",
/// "type": "string"
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteRequestArgument {
///The name of the argument
pub name: ::std::string::String,
///The value of the argument to use for completion matching.
pub value: ::std::string::String,
}
///CompleteRequestParams
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "argument",
/// "ref"
/// ],
/// "properties": {
/// "argument": {
/// "description": "The argument's information",
/// "type": "object",
/// "required": [
/// "name",
/// "value"
/// ],
/// "properties": {
/// "name": {
/// "description": "The name of the argument",
/// "type": "string"
/// },
/// "value": {
/// "description": "The value of the argument to use for completion matching.",
/// "type": "string"
/// }
/// }
/// },
/// "ref": {
/// "anyOf": [
/// {
/// "$ref": "#/definitions/PromptReference"
/// },
/// {
/// "$ref": "#/definitions/ResourceReference"
/// }
/// ]
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteRequestParams {
pub argument: CompleteRequestArgument,
#[serde(rename = "ref")]
pub ref_: CompleteRequestRef,
}
///CompleteRequestRef
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "anyOf": [
/// {
/// "$ref": "#/definitions/PromptReference"
/// },
/// {
/// "$ref": "#/definitions/ResourceReference"
/// }
/// ]
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
#[serde(untagged)]
pub enum CompleteRequestRef {
PromptReference(PromptReference),
ResourceReference(ResourceReference),
}
impl ::std::convert::From<PromptReference> for CompleteRequestRef {
fn from(value: PromptReference) -> Self {
Self::PromptReference(value)
}
}
impl ::std::convert::From<ResourceReference> for CompleteRequestRef {
fn from(value: ResourceReference) -> Self {
Self::ResourceReference(value)
}
}
///The server's response to a completion/complete request
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "description": "The server's response to a completion/complete request",
/// "type": "object",
/// "required": [
/// "completion"
/// ],
/// "properties": {
/// "_meta": {
/// "description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
/// "type": "object",
/// "additionalProperties": {}
/// },
/// "completion": {
/// "type": "object",
/// "required": [
/// "values"
/// ],
/// "properties": {
/// "hasMore": {
/// "description": "Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.",
/// "type": "boolean"
/// },
/// "total": {
/// "description": "The total number of completion options available. This can exceed the number of values actually sent in the response.",
/// "type": "integer"
/// },
/// "values": {
/// "description": "An array of completion values. Must not exceed 100 items.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// }
/// }
/// }
/// }
///}
/// ```
/// </details>
#[derive(::serde::Deserialize, ::serde::Serialize, Clone, Debug)]
pub struct CompleteResult {
pub completion: CompleteResultCompletion,
///This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.
#[serde(rename = "_meta", default, skip_serializing_if = "::std::option::Option::is_none")]
pub meta: ::std::option::Option<::serde_json::Map<::std::string::String, ::serde_json::Value>>,
}
///CompleteResultCompletion
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
/// "type": "object",
/// "required": [
/// "values"
/// ],
/// "properties": {
/// "hasMore": {
/// "description": "Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.",
/// "type": "boolean"
/// },
/// "total": {
/// "description": "The total number of completion options available. This can exceed the number of values actually sent in the response.",
/// "type": "integer"
/// },
/// "values": {
/// "description": "An array of completion values. Must not exceed 100 items.",
/// "type": "array",
/// "items": {
/// "type": "string"
/// }
/// }
/// }
///}