pub struct Server {
pub spec_location: SpecLocation,
pub tool_collection: ToolCollection,
pub base_url: Option<Url>,
pub default_headers: Option<HeaderMap>,
pub tag_filter: Option<Vec<String>>,
pub method_filter: Option<Vec<Method>>,
}Fields§
§spec_location: SpecLocation§tool_collection: ToolCollection§base_url: Option<Url>§default_headers: Option<HeaderMap>§tag_filter: Option<Vec<String>>§method_filter: Option<Vec<Method>>Implementations§
Source§impl Server
impl Server
Sourcepub fn builder() -> ServerBuilder
pub fn builder() -> ServerBuilder
Create an instance of Server using the builder syntax
Source§impl Server
impl Server
Sourcepub fn new(spec_location: SpecLocation) -> Self
pub fn new(spec_location: SpecLocation) -> Self
Create a new server with basic configuration (backwards compatibility)
Sourcepub fn with_base_url(
spec_location: SpecLocation,
base_url: Url,
) -> Result<Self, Error>
pub fn with_base_url( spec_location: SpecLocation, base_url: Url, ) -> Result<Self, Error>
Create a new server with a base URL for API calls (backwards compatibility)
§Errors
Returns an error if the base URL is invalid
Sourcepub fn with_base_url_and_headers(
spec_location: SpecLocation,
base_url: Url,
default_headers: HeaderMap,
) -> Result<Self, Error>
pub fn with_base_url_and_headers( spec_location: SpecLocation, base_url: Url, default_headers: HeaderMap, ) -> Result<Self, Error>
Create a new server with both base URL and default headers (backwards compatibility)
§Errors
Returns an error if the base URL is invalid
Sourcepub fn with_default_headers(
spec_location: SpecLocation,
default_headers: HeaderMap,
) -> Self
pub fn with_default_headers( spec_location: SpecLocation, default_headers: HeaderMap, ) -> Self
Create a new server with default headers but no base URL (backwards compatibility)
Sourcepub async fn load_openapi_spec(&mut self) -> Result<(), Error>
pub async fn load_openapi_spec(&mut self) -> Result<(), Error>
Load the OpenAPI specification and convert to OpenApiTool instances
§Errors
Returns an error if the spec cannot be loaded or tools cannot be generated
Sourcepub fn tool_count(&self) -> usize
pub fn tool_count(&self) -> usize
Get the number of loaded tools
Sourcepub fn get_tool_names(&self) -> Vec<String>
pub fn get_tool_names(&self) -> Vec<String>
Get all tool names
Sourcepub fn get_tool_metadata(&self, name: &str) -> Option<&ToolMetadata>
pub fn get_tool_metadata(&self, name: &str) -> Option<&ToolMetadata>
Get tool metadata by name
Sourcepub fn get_tool_stats(&self) -> String
pub fn get_tool_stats(&self) -> String
Get basic tool statistics
Set tag filter for this server instance
Sourcepub fn with_methods(self, methods: Option<Vec<Method>>) -> Self
pub fn with_methods(self, methods: Option<Vec<Method>>) -> Self
Set method filter for this server instance