pub struct MCP {
pub server_label: String,
pub server_url: Option<String>,
pub transport_type: Option<MCPTransportType>,
pub allowed_tools: Vec<String>,
pub headers: Option<HashMap<String, String>>,
}Expand description
Represents the MCP connection configuration. When connecting to Zhipu’s MCP server
using an MCP code, fill server_label with that code and leave server_url empty.
Fields§
§server_label: StringMCP server identifier (required). If connecting to Zhipu MCP via code, put the code here.
server_url: Option<String>MCP server URL.
transport_type: Option<MCPTransportType>Transport type. Default: streamable-http.
allowed_tools: Vec<String>Allowed tool names.
headers: Option<HashMap<String, String>>Authentication headers required by the MCP server.
Implementations§
Source§impl MCP
impl MCP
Sourcepub fn new(server_label: impl Into<String>) -> Self
pub fn new(server_label: impl Into<String>) -> Self
Create a new MCP config with required server_label and default transport type.
Sourcepub fn with_server_url(self, url: impl Into<String>) -> Self
pub fn with_server_url(self, url: impl Into<String>) -> Self
Set the MCP server URL.
Sourcepub fn with_transport_type(self, transport: MCPTransportType) -> Self
pub fn with_transport_type(self, transport: MCPTransportType) -> Self
Set the MCP transport type.
Sourcepub fn with_allowed_tools(self, tools: impl Into<Vec<String>>) -> Self
pub fn with_allowed_tools(self, tools: impl Into<Vec<String>>) -> Self
Replace the allowed tool list.
Sourcepub fn add_allowed_tool(self, tool: impl Into<String>) -> Self
pub fn add_allowed_tool(self, tool: impl Into<String>) -> Self
Add a single allowed tool.
Sourcepub fn with_headers(self, headers: HashMap<String, String>) -> Self
pub fn with_headers(self, headers: HashMap<String, String>) -> Self
Set authentication headers map.
Trait Implementations§
Source§impl<'v_a> ValidateArgs<'v_a> for MCP
impl<'v_a> ValidateArgs<'v_a> for MCP
Auto Trait Implementations§
impl Freeze for MCP
impl RefUnwindSafe for MCP
impl Send for MCP
impl Sync for MCP
impl Unpin for MCP
impl UnwindSafe for MCP
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more