INNER CODE UNIT · Rust

headless_authorize

modelcontextprotocol/rust-sdk · conformance/src/bin/client.rs:855

async fn headless_authorize(auth_url: &str) -> anyhow::Result<AuthorizationCallback> {
    let http = reqwest::Client::builder()
        .redirect(reqwest::redirect::Policy::none())
        .build()?;
    let resp = http.get(auth_url).send().await?;
    let location = resp
        .headers()
        .get("location")
        .and_then(|v| v.to_str().ok())
        .ok_or_else(|| anyhow::anyhow!("No Location header in auth redirect"))?;
    AuthorizationCallback::from_redirect_url(location).map_err(Into::into)
}

/// Build a `CallToolRequestParams` for a tool, optionally with arguments.
fn call_tool_params(
    name: std::borrow::Cow<'static, str>,
    arguments: Option<serde_json::Map<String, Value>>,
) -> CallToolRequestParams {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…