feat(task): add task support (SEP-1686) (#536)
Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
This commit is contained in:
parent
eeacd1375f
commit
621c9f619e
6 changed files with 1922 additions and 57 deletions
|
|
@ -49,6 +49,7 @@ async fn main() -> Result<()> {
|
|||
.call_tool(CallToolRequestParam {
|
||||
name: "git_status".into(),
|
||||
arguments: serde_json::json!({ "repo_path": "." }).as_object().cloned(),
|
||||
task: None,
|
||||
})
|
||||
.await?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ async fn main() -> Result<()> {
|
|||
.call_tool(CallToolRequestParam {
|
||||
name: "echo".into(),
|
||||
arguments: Some(object!({ "message": "hi from rmcp" })),
|
||||
task: None,
|
||||
})
|
||||
.await?;
|
||||
tracing::info!("Tool result for echo: {tool_result:#?}");
|
||||
|
|
@ -49,6 +50,7 @@ async fn main() -> Result<()> {
|
|||
.call_tool(CallToolRequestParam {
|
||||
name: "longRunningOperation".into(),
|
||||
arguments: Some(object!({ "duration": 3, "steps": 1 })),
|
||||
task: None,
|
||||
})
|
||||
.await?;
|
||||
tracing::info!("Tool result for longRunningOperation: {tool_result:#?}");
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ async fn main() -> Result<(), RmcpError> {
|
|||
.call_tool(CallToolRequestParam {
|
||||
name: "git_status".into(),
|
||||
arguments: serde_json::json!({ "repo_path": "." }).as_object().cloned(),
|
||||
task: None,
|
||||
})
|
||||
.await?;
|
||||
tracing::info!("Tool result: {tool_result:#?}");
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ async fn test_stdio_transport(records: u32) -> Result<()> {
|
|||
.call_tool(CallToolRequestParam {
|
||||
name: "stream_processor".into(),
|
||||
arguments: None,
|
||||
task: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
|
@ -238,6 +239,7 @@ async fn test_http_transport(http_url: &str, records: u32) -> Result<()> {
|
|||
.call_tool(CallToolRequestParam {
|
||||
name: "stream_processor".into(),
|
||||
arguments: None,
|
||||
task: None,
|
||||
})
|
||||
.await?;
|
||||
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ async fn main() -> Result<()> {
|
|||
arguments: Some(object!({
|
||||
"question": "Hello world"
|
||||
})),
|
||||
task: None,
|
||||
})
|
||||
.await
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ async fn main() -> Result<()> {
|
|||
.call_tool(CallToolRequestParam {
|
||||
name: "increment".into(),
|
||||
arguments: serde_json::json!({}).as_object().cloned(),
|
||||
task: None,
|
||||
})
|
||||
.await?;
|
||||
tracing::info!("Tool result: {tool_result:#?}");
|
||||
|
|
|
|||
Loading…
Reference in a new issue