fix(acp): preserve content audience boundaries (#10493)
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::session::SESSION_ID_HEADER;
|
||||
use crate::ExpectedSessionId;
|
||||
use rmcp::model::{
|
||||
CallToolResult, ClientNotification, ClientRequest, Content, ErrorCode, Implementation,
|
||||
InitializeResult, Meta, ProtocolVersion, ServerCapabilities, ServerInfo,
|
||||
InitializeResult, Meta, ProtocolVersion, Role, ServerCapabilities, ServerInfo,
|
||||
};
|
||||
use rmcp::service::{DynService, NotificationContext, RequestContext, ServiceExt, ServiceRole};
|
||||
use rmcp::transport::streamable_http_server::{
|
||||
@@ -108,6 +108,17 @@ impl McpFixtureServer {
|
||||
"image/png",
|
||||
)]))
|
||||
}
|
||||
|
||||
#[tool(
|
||||
description = "Get audience-scoped content",
|
||||
annotations(read_only_hint = true)
|
||||
)]
|
||||
fn get_audience_content(&self) -> Result<CallToolResult, McpError> {
|
||||
Ok(CallToolResult::success(vec![
|
||||
Content::text("visible"),
|
||||
Content::text("provider-only").with_audience(vec![Role::Assistant]),
|
||||
]))
|
||||
}
|
||||
}
|
||||
|
||||
#[tool_handler]
|
||||
@@ -116,7 +127,7 @@ impl ServerHandler for McpFixtureServer {
|
||||
InitializeResult::new(ServerCapabilities::builder().enable_tools().build())
|
||||
.with_protocol_version(ProtocolVersion::V_2025_03_26)
|
||||
.with_server_info(Implementation::new("mcp-fixture", "1.0.0"))
|
||||
.with_instructions("Test server with get_code and get_image tools.")
|
||||
.with_instructions("Test server with code, image, and audience-scoped content tools.")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user