@@ -8,6 +8,7 @@ mod meta;
88mod prompt;
99mod resource;
1010mod serde_impl;
11+ mod task;
1112mod tool;
1213pub use annotated:: * ;
1314pub use capabilities:: * ;
@@ -19,6 +20,7 @@ pub use prompt::*;
1920pub use resource:: * ;
2021use serde:: { Deserialize , Serialize , de:: DeserializeOwned } ;
2122use serde_json:: Value ;
23+ pub use task:: * ;
2224pub use tool:: * ;
2325
2426/// A JSON object type alias for convenient handling of JSON data.
@@ -1639,6 +1641,7 @@ paginated_result!(
16391641 }
16401642) ;
16411643
1644+
16421645const_string ! ( CallToolRequestMethod = "tools/call" ) ;
16431646/// Parameters for calling a tool provided by an MCP server.
16441647///
@@ -1653,6 +1656,8 @@ pub struct CallToolRequestParam {
16531656 /// Arguments to pass to the tool (must match the tool's input schema)
16541657 #[ serde( skip_serializing_if = "Option::is_none" ) ]
16551658 pub arguments : Option < JsonObject > ,
1659+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1660+ pub task : Option < JsonObject > ,
16561661}
16571662
16581663/// Request to call a specific tool
@@ -1691,6 +1696,23 @@ pub struct GetPromptResult {
16911696 pub messages : Vec < PromptMessage > ,
16921697}
16931698
1699+ // =============================================================================
1700+ // TASK MANAGEMENT
1701+ // =============================================================================
1702+
1703+ const_string ! ( GetTaskInfoMethod = "tasks/get" ) ;
1704+ pub type GetTaskInfoRequest = Request < GetTaskInfoMethod , GetTaskInfoParam > ;
1705+
1706+ #[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
1707+ #[ serde( rename_all = "camelCase" ) ]
1708+ #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
1709+ pub struct GetTaskInfoParam {
1710+ pub task_id : String ,
1711+ }
1712+
1713+ const_string ! ( ListTasksMethod = "tasks/list" ) ;
1714+ pub type ListTasksRequest = RequestOptionalParam < ListTasksMethod , PaginatedRequestParam > ;
1715+
16941716// =============================================================================
16951717// MESSAGE TYPE UNIONS
16961718// =============================================================================
@@ -1757,7 +1779,9 @@ ts_union!(
17571779 | SubscribeRequest
17581780 | UnsubscribeRequest
17591781 | CallToolRequest
1760- | ListToolsRequest ;
1782+ | ListToolsRequest
1783+ | GetTaskInfoRequest
1784+ | ListTasksRequest ;
17611785) ;
17621786
17631787impl ClientRequest {
@@ -1776,6 +1800,8 @@ impl ClientRequest {
17761800 ClientRequest :: UnsubscribeRequest ( r) => r. method . as_str ( ) ,
17771801 ClientRequest :: CallToolRequest ( r) => r. method . as_str ( ) ,
17781802 ClientRequest :: ListToolsRequest ( r) => r. method . as_str ( ) ,
1803+ ClientRequest :: GetTaskInfoRequest ( r) => r. method . as_str ( ) ,
1804+ ClientRequest :: ListTasksRequest ( r) => r. method . as_str ( ) ,
17791805 }
17801806 }
17811807}
@@ -1832,6 +1858,8 @@ ts_union!(
18321858 | CallToolResult
18331859 | ListToolsResult
18341860 | CreateElicitationResult
1861+ | GetTaskInfoResult
1862+ | ListTasksResult
18351863 | EmptyResult
18361864 ;
18371865) ;
@@ -1842,6 +1870,28 @@ impl ServerResult {
18421870 }
18431871}
18441872
1873+ // =============================================================================
1874+ // TASK RESULT TYPES (Server responses for task queries)
1875+ // =============================================================================
1876+ #[ derive( Debug , Serialize , Deserialize , Clone , PartialEq ) ]
1877+ #[ serde( rename_all = "camelCase" ) ]
1878+ #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
1879+ pub struct GetTaskInfoResult {
1880+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1881+ pub task : Option < crate :: model:: Task > ,
1882+ }
1883+
1884+ #[ derive( Debug , Serialize , Deserialize , Clone , PartialEq , Default ) ]
1885+ #[ serde( rename_all = "camelCase" ) ]
1886+ #[ cfg_attr( feature = "schemars" , derive( schemars:: JsonSchema ) ) ]
1887+ pub struct ListTasksResult {
1888+ pub tasks : Vec < crate :: model:: Task > ,
1889+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1890+ pub next_cursor : Option < String > ,
1891+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
1892+ pub total : Option < u64 > ,
1893+ }
1894+
18451895pub type ServerJsonRpcMessage = JsonRpcMessage < ServerRequest , ServerResult , ServerNotification > ;
18461896
18471897impl TryInto < CancelledNotification > for ServerNotification {
0 commit comments