openagent-mcp · middleware
Declared module signatures, types, configuration, and source documentation.
Source: openagent-sdk/integrations/mcp/rust/src/middleware.rs. SHA-256: 4fc7a846d77047ae227b86d30edf99d9cc86666781c3bb2a00168c404965d9fe.
This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.
middleware::default_scope_format
Default scope format used when [Config::with_require_scopes] is
not supplied. Returns mcp:<tool>:invoke.
pub fn default_scope_format(tool_name: &str) -> String;Source line: 32.
middleware::default_require_scopes
Default scope deriver used when [Config::with_require_scopes] is
not supplied.
pub fn default_require_scopes(tool_name: &str, _args: &serde_json::Value) -> Vec<String>;Source line: 38.
middleware::OpenAgentMiddleware
The middleware engine.
Cheap to clone — internally just an Arc over the config and a
derived scope deriver.
#[derive(Clone)]
pub struct OpenAgentMiddleware {
}Source line: 47.
middleware::OpenAgentMiddleware::new
Create a new middleware engine.
pub fn new(config: Config) -> Self;Source line: 62.
middleware::OpenAgentMiddleware::run
Run the middleware pipeline against a single call. The
inner closure is invoked once the auth pipeline approves the
call. It receives the (unmodified) ToolCall.
This is the function adapters call from inside their concrete
call_tool implementations. Most users do not call it
directly — they wrap their handler with
[crate::WithOpenAgent::with_openagent] instead.
pub async fn run<F>(&self, call: ToolCall, inner: F) -> Result<ToolResult, McpAuthError>
where
F: FnOnce(
ToolCall,
)
-> Pin<Box<dyn std::future::Future<Output = Result<ToolResult, McpAuthError>> + Send>>
+ Send
+ 'static,;Source line: 82.