feat: add local feature for !Send tool handler support (#740)
* feat: add local feature for !Send tool handler support * fix: gate streamable HTTP transport on not(local) feature
This commit is contained in:
parent
8700e5c920
commit
1a4a52a173
22 changed files with 362 additions and 222 deletions
|
|
@ -7,7 +7,11 @@ use std::{
|
|||
use rmcp::service::NotificationContext;
|
||||
#[cfg(feature = "client")]
|
||||
use rmcp::{ClientHandler, RoleClient};
|
||||
use rmcp::{ErrorData as McpError, RoleServer, ServerHandler, model::*, service::RequestContext};
|
||||
use rmcp::{
|
||||
ErrorData as McpError, RoleServer, ServerHandler,
|
||||
model::*,
|
||||
service::{MaybeSendFuture, RequestContext},
|
||||
};
|
||||
#[cfg(feature = "client")]
|
||||
use serde_json::json;
|
||||
use tokio::sync::Notify;
|
||||
|
|
@ -85,7 +89,7 @@ impl ClientHandler for TestClientHandler {
|
|||
&self,
|
||||
params: LoggingMessageNotificationParam,
|
||||
_context: NotificationContext<RoleClient>,
|
||||
) -> impl Future<Output = ()> + Send + '_ {
|
||||
) -> impl Future<Output = ()> + MaybeSendFuture + '_ {
|
||||
let receive_signal = self.receive_signal.clone();
|
||||
let received_messages = self.received_messages.clone();
|
||||
|
||||
|
|
@ -116,7 +120,7 @@ impl ServerHandler for TestServer {
|
|||
&self,
|
||||
request: SetLevelRequestParams,
|
||||
context: RequestContext<RoleServer>,
|
||||
) -> impl Future<Output = Result<(), McpError>> + Send + '_ {
|
||||
) -> impl Future<Output = Result<(), McpError>> + MaybeSendFuture + '_ {
|
||||
let peer = context.peer;
|
||||
async move {
|
||||
let (data, logger) = match request.level {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// cargo test --features "server client" --package rmcp test_client_initialization
|
||||
#![cfg(feature = "client")]
|
||||
#![cfg(all(feature = "client", not(feature = "local")))]
|
||||
|
||||
mod common;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
//cargo test --test test_close_connection --features "client server"
|
||||
|
||||
mod common;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
use std::collections::HashMap;
|
||||
|
||||
use http::{HeaderName, HeaderValue};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
use std::sync::Arc;
|
||||
|
||||
use rmcp::{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// cargo test --features "server client" --package rmcp test_logging
|
||||
#![cfg(not(feature = "local"))]
|
||||
mod common;
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
//cargo test --test test_message_protocol --features "client server"
|
||||
#![cfg(not(feature = "local"))]
|
||||
|
||||
mod common;
|
||||
use common::handlers::{TestClientHandler, TestServer};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
use std::sync::Arc;
|
||||
|
||||
use rmcp::{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
use futures::StreamExt;
|
||||
use rmcp::{
|
||||
ClientHandler, Peer, RoleServer, ServerHandler, ServiceExt,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
//cargo test --test test_prompt_macros --features "client server"
|
||||
#![allow(dead_code)]
|
||||
use std::sync::Arc;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
use std::collections::HashMap;
|
||||
|
||||
use futures::future::BoxFuture;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
mod common;
|
||||
|
||||
use anyhow::Result;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// cargo test --features "client" --package rmcp -- server_init
|
||||
#![cfg(feature = "client")]
|
||||
#![cfg(all(feature = "client", not(feature = "local")))]
|
||||
mod common;
|
||||
|
||||
use common::handlers::TestServer;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
/// Tests for concurrent SSE stream handling (shadow channels)
|
||||
///
|
||||
/// These tests verify that multiple GET SSE streams on the same session
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
use rmcp::transport::streamable_http_server::{
|
||||
StreamableHttpServerConfig, StreamableHttpService, session::local::LocalSessionManager,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
use std::time::Duration;
|
||||
|
||||
use rmcp::transport::streamable_http_server::{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
#![cfg(all(
|
||||
feature = "transport-streamable-http-client",
|
||||
feature = "transport-streamable-http-client-reqwest",
|
||||
feature = "transport-streamable-http-server"
|
||||
feature = "transport-streamable-http-server",
|
||||
not(feature = "local")
|
||||
))]
|
||||
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
//! Tests for task support validation in tool calls.
|
||||
//!
|
||||
//! Verifies that the server correctly validates `execution.taskSupport` settings
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
//! Test tool macros, including documentation for generated fns.
|
||||
|
||||
//cargo test --test test_tool_macros --features "client server"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#![cfg(not(feature = "local"))]
|
||||
use std::collections::HashMap;
|
||||
|
||||
use futures::future::BoxFuture;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue