{
  "name": "forge-mcp",
  "language": "rust",
  "version": "0.2.0",
  "description": "Model Context Protocol (MCP) client, server, and transport layer for the Forge SDK",
  "manifest": "forge-rs/crates/forge-mcp/Cargo.toml",
  "manifestSha256": "d16e8f459ba7f7c8a1003389291533b4098bea6dc5d8a2da1b905fd97bfbdede",
  "status": "source-reference",
  "registryPublicationVerified": false,
  "route": "/libraries/rust/forge-mcp",
  "features": {},
  "files": [
    {
      "path": "forge-rs/crates/forge-mcp/src/auth.rs",
      "sha256": "cc21378a8aae74472b4d803ae8666bdf38f91e82ac42b4c88d09be0223512f98",
      "artifactSha256": "1c03a64d2bf840d9ae768b032de7650af3454e731b282b9daa07657430a0ea09",
      "url": "/reference/source/forge-rs/crates/forge-mcp/src/auth.rs.txt",
      "declarations": [
        {
          "name": "::OAuthConfig",
          "line": 37,
          "signature": "#[derive(Debug, Clone, PartialEq, Eq)]\npub struct OAuthConfig {\n/// The OAuth client ID registered with the authorization server.\n\npub client_id: String,\n/// The OAuth client secret, if the client is confidential.\n\n///\n\n/// Public clients (e.g., CLI tools) should leave this as `None`\n\n/// and rely on PKCE for security.\n\npub client_secret: Option<String>,\n/// The redirect URI for receiving the authorization code.\n\npub redirect_uri: String,\n/// The authorization endpoint URL.\n\npub auth_url: String,\n/// The token endpoint URL for exchanging codes for tokens.\n\npub token_url: String\n}",
          "documentation": "OAuth 2.0 configuration for authenticating with an MCP server.\n\nWhen an MCP server requires authentication, the client uses this\nconfiguration to perform an OAuth 2.0 authorization code flow with\nPKCE (RFC 7636).\n\n# Examples\n\n```\nuse forge_mcp::auth::OAuthConfig;\n\nlet config = OAuthConfig {\n    client_id: \"my-forge-app\".to_string(),\n    client_secret: None,\n    redirect_uri: \"http://localhost:3000/callback\".to_string(),\n    auth_url: \"https://auth.example.com/authorize\".to_string(),\n    token_url: \"https://auth.example.com/token\".to_string(),\n};\nassert_eq!(config.client_id, \"my-forge-app\");\n```"
        },
        {
          "name": "::PkceChallenge",
          "line": 72,
          "signature": "#[derive(Debug, Clone, PartialEq, Eq)]\npub struct PkceChallenge {\n/// The code verifier -- a high-entropy random string sent during\n\n/// the token exchange.\n\npub verifier: String,\n/// The code challenge -- the SHA-256 hash of the verifier, Base64url-encoded.\n\n/// Sent during the authorization request.\n\npub challenge: String,\n/// The challenge method (always \"S256\" for SHA-256).\n\npub method: String\n}",
          "documentation": "A PKCE (Proof Key for Code Exchange) challenge pair.\n\nPKCE (RFC 7636) prevents authorization code interception attacks by\nbinding the authorization request to the token exchange via a\ncryptographic challenge.\n\n# Examples\n\n```\nuse forge_mcp::auth::PkceChallenge;\n\nlet challenge = PkceChallenge {\n    verifier: \"dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk\".to_string(),\n    challenge: \"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM\".to_string(),\n    method: \"S256\".to_string(),\n};\nassert_eq!(challenge.method, \"S256\");\n```"
        },
        {
          "name": "::generate_pkce_challenge",
          "line": 116,
          "signature": "pub fn generate_pkce_challenge(verifier_bytes: &[u8]) -> ForgeMcpResult<PkceChallenge>;",
          "documentation": "Generates a PKCE S256 challenge pair from the given verifier bytes.\n\nThe verifier is Base64url-encoded (no padding), and the challenge is the\nSHA-256 hash of the verifier string, also Base64url-encoded (no padding).\n\n# Arguments\n\n* `verifier_bytes` - Random bytes to use as the verifier source. Must be\n  at least 32 bytes for adequate entropy. The MCP/OAuth spec recommends\n  32-96 bytes.\n\n# Returns\n\nA `PkceChallenge` containing the verifier, challenge, and method.\n\n# Errors\n\nReturns `ForgeMcpError::AuthError` if `verifier_bytes` is fewer than\n32 bytes.\n\n# Examples\n\n```\nuse forge_mcp::auth::generate_pkce_challenge;\n\nlet random_bytes = [0x42u8; 32];\nlet challenge = generate_pkce_challenge(&random_bytes).unwrap();\nassert_eq!(challenge.method, \"S256\");\nassert!(!challenge.verifier.is_empty());\nassert!(!challenge.challenge.is_empty());\n// Verifier and challenge are different\nassert_ne!(challenge.verifier, challenge.challenge);\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-mcp/src/client.rs",
      "sha256": "adccfb8db17c77cda36b6d783f341468f21f862628014c6a2fe3a3b2235e3805",
      "artifactSha256": "79590970c023fb067809252c1c962e37c30678771bc403dece0881c46508e984",
      "url": "/reference/source/forge-rs/crates/forge-mcp/src/client.rs.txt",
      "declarations": [
        {
          "name": "::McpClientConfig",
          "line": 56,
          "signature": "#[derive(Debug, Clone)]\npub struct McpClientConfig {\n/// Transport configuration (stdio, SSE, or HTTP).\n\npub transport: TransportConfig,\n/// Optional OAuth configuration for authenticated servers.\n\npub auth: Option<OAuthConfig>\n}",
          "documentation": "Configuration for constructing an `McpClient`.\n\nSpecifies the transport to use and optional OAuth credentials for\nauthenticated MCP servers.\n\n# Examples\n\n```\nuse forge_mcp::client::McpClientConfig;\nuse forge_mcp::transport::TransportConfig;\n\nlet config = McpClientConfig {\n    transport: TransportConfig::Stdio,\n    auth: None,\n};\n```"
        },
        {
          "name": "::McpClient",
          "line": 89,
          "signature": "pub struct McpClient {\n\n}",
          "documentation": "An MCP client that communicates with a single MCP server.\n\nThe client manages the transport lifecycle, negotiates capabilities during\nthe initialization handshake, and provides methods for each MCP feature:\ntool listing/invocation, resource access, and prompt retrieval.\n\n# Lifecycle\n\n1. Create a `McpClientConfig` with the desired transport and auth settings.\n2. Call `McpClient::connect()` to establish the connection and negotiate capabilities.\n3. Use `list_tools()`, `call_tool()`, `list_resources()`, etc.\n4. Call `disconnect()` when done.\n\n# Examples\n\n```\nuse forge_mcp::client::{McpClient, McpClientConfig};\nuse forge_mcp::transport::TransportConfig;\n\nlet config = McpClientConfig {\n    transport: TransportConfig::Stdio,\n    auth: None,\n};\n\n// McpClient::connect(config).await would establish the connection.\n```"
        },
        {
          "name": "::McpClient::connect",
          "line": 136,
          "signature": "pub async fn connect(config: McpClientConfig) -> ForgeMcpResult<Self>;",
          "documentation": "Connects to an MCP server using the provided configuration.\n\nThis performs the MCP initialization handshake:\n1. Opens the transport.\n2. Sends an `initialize` request with client capabilities.\n3. Receives the server's capabilities.\n4. Sends an `initialized` notification.\n\n# Arguments\n\n* `config` - The client configuration specifying transport and auth.\n\n# Returns\n\nA connected `McpClient` ready for use.\n\n# Errors\n\nReturns `ForgeMcpError::ConnectionFailed` if the handshake fails,\nor `ForgeMcpError::TransportError` if the underlying transport cannot\nbe opened.\n\n# Examples\n\n```no_run\nuse forge_mcp::client::{McpClient, McpClientConfig};\nuse forge_mcp::transport::TransportConfig;\n\n# async fn example() -> Result<(), forge_mcp::error::ForgeMcpError> {\nlet config = McpClientConfig {\n    transport: TransportConfig::Stdio,\n    auth: None,\n};\nlet client = McpClient::connect(config).await?;\n# Ok(())\n# }\n```"
        },
        {
          "name": "::McpClient::capabilities",
          "line": 253,
          "signature": "pub fn capabilities(&self) -> &McpCapabilities;",
          "documentation": "Returns the capabilities negotiated with the server.\n\n# Examples\n\n```\nuse forge_mcp::types::McpCapabilities;\n\n// After connecting, check what the server supports:\n// let caps = client.capabilities();\n// if caps.tools { /* list and call tools */ }\n```"
        },
        {
          "name": "::McpClient::list_tools",
          "line": 281,
          "signature": "pub async fn list_tools(&self) -> ForgeMcpResult<Vec<McpToolDescriptor>>;",
          "documentation": "Lists all tools available on the MCP server.\n\nSends a `tools/list` request and returns the tool descriptors.\n\n# Returns\n\nA vector of `McpToolDescriptor` items representing available tools.\n\n# Errors\n\nReturns `ForgeMcpError::ProtocolError` if the server returns an error,\nor `ForgeMcpError::TransportError` if communication fails.\n\n# Examples\n\n```no_run\n# async fn example(client: &forge_mcp::client::McpClient) -> Result<(), forge_mcp::error::ForgeMcpError> {\nlet tools = client.list_tools().await?;\nfor tool in &tools {\n    println!(\"Tool: {} - {}\", tool.name, tool.description);\n}\n# Ok(())\n# }\n```"
        },
        {
          "name": "::McpClient::call_tool",
          "line": 332,
          "signature": "pub async fn call_tool(\n        &self,\n        name: &str,\n        arguments: serde_json::Value,\n    ) -> ForgeMcpResult<serde_json::Value>;",
          "documentation": "Invokes a tool on the MCP server.\n\nSends a `tools/call` request with the specified tool name and arguments,\nand returns the server's response.\n\n# Arguments\n\n* `name` - The tool name to invoke.\n* `arguments` - JSON arguments for the tool.\n\n# Returns\n\nThe JSON response from the tool execution.\n\n# Errors\n\nReturns `ForgeMcpError::ToolNotFound` if the server reports the tool\ndoes not exist, `ForgeMcpError::ProtocolError` for other server errors,\nor `ForgeMcpError::TransportError` if communication fails.\n\n# Examples\n\n```no_run\n# async fn example(client: &forge_mcp::client::McpClient) -> Result<(), forge_mcp::error::ForgeMcpError> {\nuse serde_json::json;\n\nlet result = client.call_tool(\"read_file\", json!({\"path\": \"/tmp/data.txt\"})).await?;\nprintln!(\"Tool result: {}\", result);\n# Ok(())\n# }\n```"
        },
        {
          "name": "::McpClient::list_resources",
          "line": 377,
          "signature": "pub async fn list_resources(&self) -> ForgeMcpResult<Vec<McpResource>>;",
          "documentation": "Lists all resources available on the MCP server.\n\nSends a `resources/list` request and returns the resource descriptors.\n\n# Returns\n\nA vector of `McpResource` items representing available resources.\n\n# Errors\n\nReturns `ForgeMcpError::ProtocolError` if the server returns an error,\nor `ForgeMcpError::TransportError` if communication fails.\n\n# Examples\n\n```no_run\n# async fn example(client: &forge_mcp::client::McpClient) -> Result<(), forge_mcp::error::ForgeMcpError> {\nlet resources = client.list_resources().await?;\nfor res in &resources {\n    println!(\"Resource: {} ({})\", res.name, res.uri);\n}\n# Ok(())\n# }\n```"
        },
        {
          "name": "::McpClient::get_resource",
          "line": 423,
          "signature": "pub async fn get_resource(&self, uri: &str) -> ForgeMcpResult<serde_json::Value>;",
          "documentation": "Retrieves the content of a specific resource by URI.\n\nSends a `resources/read` request and returns the resource content.\n\n# Arguments\n\n* `uri` - The resource URI to read.\n\n# Returns\n\nThe JSON response containing the resource content.\n\n# Errors\n\nReturns `ForgeMcpError::ProtocolError` if the server returns an error,\nor `ForgeMcpError::TransportError` if communication fails.\n\n# Examples\n\n```no_run\n# async fn example(client: &forge_mcp::client::McpClient) -> Result<(), forge_mcp::error::ForgeMcpError> {\nlet content = client.get_resource(\"file:///project/README.md\").await?;\nprintln!(\"Content: {}\", content);\n# Ok(())\n# }\n```"
        },
        {
          "name": "::McpClient::list_prompts",
          "line": 458,
          "signature": "pub async fn list_prompts(&self) -> ForgeMcpResult<Vec<McpPrompt>>;",
          "documentation": "Lists all prompts available on the MCP server.\n\nSends a `prompts/list` request and returns the prompt descriptors.\n\n# Returns\n\nA vector of `McpPrompt` items representing available prompts.\n\n# Errors\n\nReturns `ForgeMcpError::ProtocolError` if the server returns an error,\nor `ForgeMcpError::TransportError` if communication fails.\n\n# Examples\n\n```no_run\n# async fn example(client: &forge_mcp::client::McpClient) -> Result<(), forge_mcp::error::ForgeMcpError> {\nlet prompts = client.list_prompts().await?;\nfor prompt in &prompts {\n    println!(\"Prompt: {}\", prompt.name);\n}\n# Ok(())\n# }\n```"
        },
        {
          "name": "::McpClient::get_prompt",
          "line": 509,
          "signature": "pub async fn get_prompt(\n        &self,\n        name: &str,\n        arguments: std::collections::HashMap<String, String>,\n    ) -> ForgeMcpResult<serde_json::Value>;",
          "documentation": "Retrieves a specific prompt by name with the given arguments.\n\nSends a `prompts/get` request and returns the prompt messages.\n\n# Arguments\n\n* `name` - The prompt name to retrieve.\n* `arguments` - A map of argument name-value pairs.\n\n# Returns\n\nThe JSON response containing the rendered prompt messages.\n\n# Errors\n\nReturns `ForgeMcpError::ProtocolError` if the server returns an error,\nor `ForgeMcpError::TransportError` if communication fails.\n\n# Examples\n\n```no_run\n# async fn example(client: &forge_mcp::client::McpClient) -> Result<(), forge_mcp::error::ForgeMcpError> {\nuse std::collections::HashMap;\n\nlet mut args = HashMap::new();\nargs.insert(\"language\".to_string(), \"Rust\".to_string());\nlet messages = client.get_prompt(\"code_review\", args).await?;\nprintln!(\"Prompt messages: {}\", messages);\n# Ok(())\n# }\n```"
        },
        {
          "name": "::McpClient::disconnect",
          "line": 547,
          "signature": "pub async fn disconnect(&self) -> ForgeMcpResult<()>;",
          "documentation": "Disconnects from the MCP server.\n\nCloses the underlying transport. After disconnecting, all other\nmethods will return errors.\n\n# Errors\n\nReturns `ForgeMcpError::TransportError` if the close fails.\n\n# Examples\n\n```no_run\n# async fn example(client: forge_mcp::client::McpClient) -> Result<(), forge_mcp::error::ForgeMcpError> {\nclient.disconnect().await?;\n# Ok(())\n# }\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-mcp/src/error.rs",
      "sha256": "7aa2b1da0f4e840c1ce332be1be9af09ca02613b18ff07b3a63e804a98047a4e",
      "artifactSha256": "40ab6fb4ceb20019b62934a545f36361a789f8c453273dd260bf0c3a9d218e8b",
      "url": "/reference/source/forge-rs/crates/forge-mcp/src/error.rs.txt",
      "declarations": [
        {
          "name": "::ForgeMcpError",
          "line": 40,
          "signature": "#[derive(Debug, Error)]\npub enum ForgeMcpError {\n    /// Failed to establish a connection to an MCP server.\n    ///\n    /// Check that the server is running, the transport configuration is correct,\n    /// and the endpoint is reachable.\n    #[error(\"MCP connection to '{endpoint}' failed: {reason}\")]\n    ConnectionFailed {\n        /// The endpoint that was being connected to.\n        endpoint: String,\n        /// What went wrong during connection.\n        reason: String,\n    },\n\n    /// A transport-level I/O error occurred.\n    ///\n    /// This covers read/write failures on the underlying transport (stdio, SSE, HTTP).\n    #[error(\"MCP transport error on '{transport}': {reason}\")]\n    TransportError {\n        /// The transport type (e.g., \"stdio\", \"sse\", \"http\").\n        transport: String,\n        /// Description of the I/O failure.\n        reason: String,\n    },\n\n    /// The MCP protocol exchange contained invalid framing or unexpected content.\n    ///\n    /// This indicates a JSON-RPC framing error, an unrecognized method, or a\n    /// protocol version mismatch.\n    #[error(\"MCP protocol error (code={code}): {message}\")]\n    ProtocolError {\n        /// The JSON-RPC error code, or -1 if not applicable.\n        code: i64,\n        /// Description of the protocol-level failure.\n        message: String,\n    },\n\n    /// The requested tool was not found on the MCP server.\n    ///\n    /// Check the tool name spelling and call `list_tools()` to see available tools.\n    #[error(\"MCP tool '{tool_name}' not found; available tools: {}\", available.join(\", \"))]\n    ToolNotFound {\n        /// The tool name that was looked up.\n        tool_name: String,\n        /// The tools that are actually available.\n        available: Vec<String>,\n    },\n\n    /// JSON serialization or deserialization of an MCP message failed.\n    #[error(\"MCP serialization error: {reason}\")]\n    SerializationError {\n        /// What went wrong during serialization.\n        reason: String,\n    },\n\n    /// Authentication or authorization failed for the MCP connection.\n    ///\n    /// Check OAuth configuration, client credentials, and token validity.\n    #[error(\"MCP auth error for endpoint '{endpoint}': {reason}\")]\n    AuthError {\n        /// The endpoint that rejected authentication.\n        endpoint: String,\n        /// Why authentication failed.\n        reason: String,\n    },\n\n    /// An error propagated from the Forge core layer.\n    #[error(\"Forge core error: {0}\")]\n    Core(#[from] ForgeError),\n}",
          "documentation": "Error type for the Forge MCP subsystem.\n\nEvery variant carries actionable context: what failed, why, and what the developer\nshould check or do next.\n\n# ANVIL Spec Reference\n\nMCP integration follows ANVIL Spec SS12.1 -- External Protocol Bridges. Error\nsemantics preserve the JSON-RPC error code from the MCP specification where\napplicable.\n\n# Examples\n\n```\nuse forge_mcp::error::ForgeMcpError;\n\nlet err = ForgeMcpError::ToolNotFound {\n    tool_name: \"read_file\".to_string(),\n    available: vec![\"list_files\".to_string(), \"write_file\".to_string()],\n};\nlet msg = err.to_string();\nassert!(msg.contains(\"read_file\"));\nassert!(msg.contains(\"list_files, write_file\"));\n```"
        },
        {
          "name": "::ForgeMcpResult",
          "line": 111,
          "signature": "pub type ForgeMcpResult<T> = Result<T, ForgeMcpError>;",
          "documentation": "A specialized `Result` type for Forge MCP operations."
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-mcp/src/lib.rs",
      "sha256": "d5d9efb86119280c6e003fea57f9bc86dde5775a7a0c4dfca325214570bfaebc",
      "artifactSha256": "8e3ba9c63a51680720e313fbe30cdcec6f7771b954c0521d390c6021315baf05",
      "url": "/reference/source/forge-rs/crates/forge-mcp/src/lib.rs.txt",
      "declarations": [
        {
          "name": "auth",
          "line": 88,
          "signature": "pub mod auth;",
          "documentation": "# forge-mcp\n\nModel Context Protocol (MCP) client, server, and transport layer for the\nForge SDK.\n\nThis crate provides the complete MCP subsystem for ANVIL-compliant agents.\nIt enables Forge agents to connect to external MCP tool servers as clients\nand to expose their own capabilities as MCP servers.\n\n# ANVIL Spec Reference\n\nThis crate implements the following ANVIL specification sections:\n- SS12.1 -- External Protocol Bridges: MCP client and server integration.\n- SS12.2 -- Transport Layer: pluggable transports (stdio, SSE, HTTP).\n- SS12.3 -- Capability Negotiation: initialization handshake.\n\n# Architecture\n\n```text\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502           forge-mcp                  \u2502\n\u2502                                      \u2502\n\u2502  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510     \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u2502\n\u2502  \u2502 McpClient\u2502     \u2502  McpServer   \u2502   \u2502\n\u2502  \u2514\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2518     \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518   \u2502\n\u2502       \u2502                  \u2502           \u2502\n\u2502       \u25bc                  \u25bc           \u2502\n\u2502  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510     \u2502\n\u2502  \u2502     McpTransport (trait)    \u2502     \u2502\n\u2502  \u2502  Stdio | SSE | HTTP        \u2502     \u2502\n\u2502  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518     \u2502\n\u2502                                      \u2502\n\u2502  \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510     \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510   \u2502\n\u2502  \u2502  types   \u2502     \u2502    auth      \u2502   \u2502\n\u2502  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518     \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518   \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n# Modules\n\n- [`client`] -- MCP client for connecting to external tool servers.\n- [`server`] -- MCP server for exposing tools, resources, and prompts.\n- [`transport`] -- Pluggable transport trait and implementations.\n- [`types`] -- MCP protocol types (tool descriptors, resources, prompts, JSON-RPC).\n- [`auth`] -- OAuth 2.0 + PKCE authentication for MCP connections.\n- [`error`] -- Typed error enum for all MCP operations.\n\n# Examples\n\n## Creating an MCP server\n\n```\nuse forge_mcp::server::{McpServer, McpServerConfig};\nuse forge_mcp::types::{McpCapabilities, McpToolDescriptor};\nuse serde_json::json;\n\nlet config = McpServerConfig {\n    name: \"my-tools\".to_string(),\n    version: \"0.1.0\".to_string(),\n    capabilities: McpCapabilities { tools: true, resources: false, prompts: false },\n};\n\nlet mut server = McpServer::new(config);\nserver.register_tool(\n    McpToolDescriptor {\n        name: \"echo\".to_string(),\n        description: \"Echoes the input\".to_string(),\n        input_schema: json!({\"type\": \"object\", \"properties\": {\"text\": {\"type\": \"string\"}}}),\n    },\n    Box::new(|_name, args| Ok(json!({\"content\": [{\"type\": \"text\", \"text\": args.to_string()}]}))),\n);\n```\n\n## Configuring an MCP client\n\n```\nuse forge_mcp::client::McpClientConfig;\nuse forge_mcp::transport::TransportConfig;\n\nlet config = McpClientConfig {\n    transport: TransportConfig::Stdio,\n    auth: None,\n};\n// McpClient::connect(config).await establishes the connection.\n```"
        },
        {
          "name": "client",
          "line": 90,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub mod client;",
          "documentation": ""
        },
        {
          "name": "error",
          "line": 91,
          "signature": "pub mod error;",
          "documentation": ""
        },
        {
          "name": "server",
          "line": 93,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub mod server;",
          "documentation": ""
        },
        {
          "name": "transport",
          "line": 95,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub mod transport;",
          "documentation": ""
        },
        {
          "name": "types",
          "line": 96,
          "signature": "pub mod types;",
          "documentation": ""
        },
        {
          "name": "prelude",
          "line": 99,
          "signature": "pub mod prelude;",
          "documentation": "Re-exports of the most commonly used types."
        },
        {
          "name": "pub use crate::auth::{generate_pkce_challenge, OAuthConfig, PkceChallenge};",
          "line": 100,
          "signature": "pub use crate::auth::{generate_pkce_challenge, OAuthConfig, PkceChallenge};",
          "documentation": ""
        },
        {
          "name": "pub use crate::client::{McpClient, McpClientConfig};",
          "line": 102,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub use crate::client::{McpClient, McpClientConfig};",
          "documentation": ""
        },
        {
          "name": "pub use crate::error::{ForgeMcpError, ForgeMcpResult};",
          "line": 103,
          "signature": "pub use crate::error::{ForgeMcpError, ForgeMcpResult};",
          "documentation": ""
        },
        {
          "name": "pub use crate::server::{McpServer, McpServerConfig};",
          "line": 105,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub use crate::server::{McpServer, McpServerConfig};",
          "documentation": ""
        },
        {
          "name": "pub use crate::transport::{\n        create_transport, HttpTransport, McpTransport, SseTransport, StdioTransport,\n        TransportConfig,\n    };",
          "line": 107,
          "signature": "#[cfg(not(target_arch = \"wasm32\"))]\npub use crate::transport::{\n        create_transport, HttpTransport, McpTransport, SseTransport, StdioTransport,\n        TransportConfig,\n    };",
          "documentation": ""
        },
        {
          "name": "pub use crate::types::{\n        McpCapabilities, McpErrorObject, McpPrompt, McpPromptArgument, McpRequest, McpRequestId,\n        McpResource, McpResponse, McpToolDescriptor,\n    };",
          "line": 111,
          "signature": "pub use crate::types::{\n        McpCapabilities, McpErrorObject, McpPrompt, McpPromptArgument, McpRequest, McpRequestId,\n        McpResource, McpResponse, McpToolDescriptor,\n    };",
          "documentation": ""
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-mcp/src/server.rs",
      "sha256": "0a67d2a153686452909756abc7d118974403346bc9d0c952de7f6886f39187c5",
      "artifactSha256": "354562dfad9c6d2cadfe60e9565070c501f160b40eb77d94687e2fa153a4399f",
      "url": "/reference/source/forge-rs/crates/forge-mcp/src/server.rs.txt",
      "declarations": [
        {
          "name": "::ToolHandler",
          "line": 48,
          "signature": "pub type ToolHandler =\n    Box<dyn Fn(&str, &serde_json::Value) -> ForgeMcpResult<serde_json::Value> + Send + Sync>;",
          "documentation": "Handler function type for tool invocations.\n\nA tool handler receives the tool name and JSON arguments and returns\na JSON result or an error."
        },
        {
          "name": "::ResourceHandler",
          "line": 55,
          "signature": "pub type ResourceHandler = Box<dyn Fn(&str) -> ForgeMcpResult<serde_json::Value> + Send + Sync>;",
          "documentation": "Handler function type for resource reads.\n\nA resource handler receives the resource URI and returns the resource\ncontent as JSON or an error."
        },
        {
          "name": "::PromptHandler",
          "line": 61,
          "signature": "pub type PromptHandler =\n    Box<dyn Fn(&str, &HashMap<String, String>) -> ForgeMcpResult<serde_json::Value> + Send + Sync>;",
          "documentation": "Handler function type for prompt rendering.\n\nA prompt handler receives the prompt name and arguments and returns\nthe rendered prompt messages as JSON or an error."
        },
        {
          "name": "::McpServerConfig",
          "line": 80,
          "signature": "#[derive(Debug, Clone, PartialEq, Eq)]\npub struct McpServerConfig {\n/// Human-readable server name.\n\npub name: String,\n/// Server version string.\n\npub version: String,\n/// Capabilities this server advertises.\n\npub capabilities: McpCapabilities\n}",
          "documentation": "Configuration for constructing an `McpServer`.\n\n# Examples\n\n```\nuse forge_mcp::server::McpServerConfig;\nuse forge_mcp::types::McpCapabilities;\n\nlet config = McpServerConfig {\n    name: \"my-tools\".to_string(),\n    version: \"1.0.0\".to_string(),\n    capabilities: McpCapabilities::all(),\n};\nassert_eq!(config.name, \"my-tools\");\n```"
        },
        {
          "name": "::McpServer",
          "line": 120,
          "signature": "pub struct McpServer {\n\n}",
          "documentation": "An MCP server that hosts tools, resources, and prompts.\n\nThe server accepts JSON-RPC requests, dispatches them to registered\nhandlers, and returns JSON-RPC responses. It manages registration of\ntools, resources, and prompts and performs the initialization handshake.\n\n# Examples\n\n```\nuse forge_mcp::server::{McpServer, McpServerConfig};\nuse forge_mcp::types::{McpCapabilities, McpToolDescriptor};\nuse serde_json::json;\n\nlet config = McpServerConfig {\n    name: \"example-server\".to_string(),\n    version: \"0.1.0\".to_string(),\n    capabilities: McpCapabilities { tools: true, resources: false, prompts: false },\n};\n\nlet mut server = McpServer::new(config);\n\n// Register a tool\nlet descriptor = McpToolDescriptor {\n    name: \"echo\".to_string(),\n    description: \"Echoes the input\".to_string(),\n    input_schema: json!({\"type\": \"object\", \"properties\": {\"text\": {\"type\": \"string\"}}}),\n};\nserver.register_tool(descriptor, Box::new(|_name, args| {\n    Ok(json!({\"content\": [{\"type\": \"text\", \"text\": args.to_string()}]}))\n}));\n```"
        },
        {
          "name": "::McpServer::new",
          "line": 154,
          "signature": "pub fn new(config: McpServerConfig) -> Self;",
          "documentation": "Creates a new MCP server with the given configuration.\n\nThe server starts with no registered tools, resources, or prompts.\nUse `register_tool()`, `register_resource()`, and `register_prompt()`\nto add capabilities before serving requests.\n\n# Arguments\n\n* `config` - The server configuration.\n\n# Examples\n\n```\nuse forge_mcp::server::{McpServer, McpServerConfig};\nuse forge_mcp::types::McpCapabilities;\n\nlet server = McpServer::new(McpServerConfig {\n    name: \"test\".to_string(),\n    version: \"0.1.0\".to_string(),\n    capabilities: McpCapabilities::all(),\n});\n```"
        },
        {
          "name": "::McpServer::register_tool",
          "line": 194,
          "signature": "pub fn register_tool(&mut self, descriptor: McpToolDescriptor, handler: ToolHandler);",
          "documentation": "Registers a tool with this server.\n\nIf a tool with the same name is already registered, it is replaced.\n\n# Arguments\n\n* `descriptor` - The tool descriptor (name, description, schema).\n* `handler` - The function that executes the tool.\n\n# Examples\n\n```\nuse forge_mcp::server::{McpServer, McpServerConfig};\nuse forge_mcp::types::{McpCapabilities, McpToolDescriptor};\nuse serde_json::json;\n\nlet mut server = McpServer::new(McpServerConfig {\n    name: \"s\".to_string(),\n    version: \"0.1.0\".to_string(),\n    capabilities: McpCapabilities::all(),\n});\n\nserver.register_tool(\n    McpToolDescriptor {\n        name: \"ping\".to_string(),\n        description: \"Returns pong\".to_string(),\n        input_schema: json!({\"type\": \"object\"}),\n    },\n    Box::new(|_name, _args| Ok(json!({\"content\": [{\"type\": \"text\", \"text\": \"pong\"}]}))),\n);\n```"
        },
        {
          "name": "::McpServer::register_resource",
          "line": 232,
          "signature": "pub fn register_resource(&mut self, resource: McpResource, handler: ResourceHandler);",
          "documentation": "Registers a resource with this server.\n\nIf a resource with the same URI is already registered, it is replaced.\n\n# Arguments\n\n* `resource` - The resource descriptor (URI, name, etc.).\n* `handler` - The function that reads the resource content.\n\n# Examples\n\n```\nuse forge_mcp::server::{McpServer, McpServerConfig};\nuse forge_mcp::types::{McpCapabilities, McpResource};\nuse serde_json::json;\n\nlet mut server = McpServer::new(McpServerConfig {\n    name: \"s\".to_string(),\n    version: \"0.1.0\".to_string(),\n    capabilities: McpCapabilities::all(),\n});\n\nserver.register_resource(\n    McpResource {\n        uri: \"file:///data.json\".to_string(),\n        name: \"data.json\".to_string(),\n        description: Some(\"Data file\".to_string()),\n        mime_type: Some(\"application/json\".to_string()),\n    },\n    Box::new(|_uri| Ok(json!({\"contents\": [{\"uri\": \"file:///data.json\", \"text\": \"{}\"}]}))),\n);\n```"
        },
        {
          "name": "::McpServer::register_prompt",
          "line": 269,
          "signature": "pub fn register_prompt(&mut self, prompt: McpPrompt, handler: PromptHandler);",
          "documentation": "Registers a prompt with this server.\n\nIf a prompt with the same name is already registered, it is replaced.\n\n# Arguments\n\n* `prompt` - The prompt descriptor (name, description, arguments).\n* `handler` - The function that renders the prompt.\n\n# Examples\n\n```\nuse forge_mcp::server::{McpServer, McpServerConfig};\nuse forge_mcp::types::{McpCapabilities, McpPrompt};\nuse serde_json::json;\n\nlet mut server = McpServer::new(McpServerConfig {\n    name: \"s\".to_string(),\n    version: \"0.1.0\".to_string(),\n    capabilities: McpCapabilities::all(),\n});\n\nserver.register_prompt(\n    McpPrompt {\n        name: \"greet\".to_string(),\n        description: Some(\"Greet someone\".to_string()),\n        arguments: vec![],\n    },\n    Box::new(|_name, _args| Ok(json!({\"messages\": []}))),\n);\n```"
        },
        {
          "name": "::McpServer::handle_request",
          "line": 310,
          "signature": "pub fn handle_request(&self, request: &McpRequest) -> McpResponse;",
          "documentation": "Handles an incoming JSON-RPC request and returns a response.\n\nDispatches the request to the appropriate handler based on the method\nname. Handles initialization, tool listing/invocation, resource\nlisting/reading, and prompt listing/retrieval.\n\n# Arguments\n\n* `request` - The parsed JSON-RPC request.\n\n# Returns\n\nA JSON-RPC response. If the method is not recognized, returns a\nmethod-not-found error response.\n\n# Examples\n\n```\nuse forge_mcp::server::{McpServer, McpServerConfig};\nuse forge_mcp::types::{McpCapabilities, McpRequest, McpRequestId};\n\nlet server = McpServer::new(McpServerConfig {\n    name: \"test\".to_string(),\n    version: \"0.1.0\".to_string(),\n    capabilities: McpCapabilities::all(),\n});\n\nlet req = McpRequest::new(McpRequestId::Number(1), \"initialize\", Some(serde_json::json!({\n    \"protocolVersion\": \"2024-11-05\",\n    \"capabilities\": {},\n    \"clientInfo\": {\"name\": \"test\", \"version\": \"0.1.0\"}\n})));\n\nlet resp = server.handle_request(&req);\nassert!(resp.is_success());\n```"
        },
        {
          "name": "::McpServer::serve",
          "line": 376,
          "signature": "pub async fn serve(&self, transport: &dyn McpTransport) -> ForgeMcpResult<()>;",
          "documentation": "Starts serving requests over the given transport.\n\nEnters a loop that reads requests from the transport, dispatches them\nvia `handle_request()`, and writes responses back. The loop exits when\nthe transport is closed or an unrecoverable transport error occurs.\n\n# Arguments\n\n* `transport` - The transport to serve on.\n\n# Errors\n\nReturns `ForgeMcpError::TransportError` if a transport read/write fails.\n\n# Examples\n\n```no_run\n# async fn example() -> Result<(), forge_mcp::error::ForgeMcpError> {\nuse forge_mcp::server::{McpServer, McpServerConfig};\nuse forge_mcp::transport::StdioTransport;\nuse forge_mcp::types::McpCapabilities;\n\nlet server = McpServer::new(McpServerConfig {\n    name: \"my-server\".to_string(),\n    version: \"0.1.0\".to_string(),\n    capabilities: McpCapabilities::all(),\n});\n\nlet transport = StdioTransport::new();\nserver.serve(&transport).await?;\n# Ok(())\n# }\n```"
        },
        {
          "name": "::McpServer::config",
          "line": 422,
          "signature": "pub fn config(&self) -> &McpServerConfig;",
          "documentation": "Returns the server configuration."
        },
        {
          "name": "::McpServer::tool_count",
          "line": 427,
          "signature": "pub fn tool_count(&self) -> usize;",
          "documentation": "Returns the number of registered tools."
        },
        {
          "name": "::McpServer::resource_count",
          "line": 432,
          "signature": "pub fn resource_count(&self) -> usize;",
          "documentation": "Returns the number of registered resources."
        },
        {
          "name": "::McpServer::prompt_count",
          "line": 437,
          "signature": "pub fn prompt_count(&self) -> usize;",
          "documentation": "Returns the number of registered prompts."
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-mcp/src/transport.rs",
      "sha256": "bd78963350e09184a385db77f16c1150aedd4d8d9281936ba8daa203bd703128",
      "artifactSha256": "de0241b80d036091eaefd7e3d5921569166dfd62f6ffce02aa7810601ac48047",
      "url": "/reference/source/forge-rs/crates/forge-mcp/src/transport.rs.txt",
      "declarations": [
        {
          "name": "::TransportConfig",
          "line": 228,
          "signature": "#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]\npub enum TransportConfig {\n    /// Standard I/O transport (stdin/stdout).\n    ///\n    /// Used when the MCP server is spawned as a child process.\n    Stdio,\n\n    /// Server-Sent Events transport.\n    ///\n    /// The client receives responses via an SSE stream and sends requests\n    /// via HTTP POST to a companion endpoint.\n    Sse {\n        /// The SSE endpoint URL.\n        url: String,\n    },\n\n    /// HTTP POST transport.\n    ///\n    /// Both requests and responses use HTTP POST with JSON bodies. This\n    /// is the simplest transport for stateless MCP servers.\n    Http {\n        /// The HTTP endpoint URL.\n        url: String,\n    },\n}",
          "documentation": "Configuration for selecting and parameterizing a transport.\n\nThe transport config is provided at client or server construction time\nand determines which concrete transport is instantiated.\n\n# Examples\n\n```\nuse forge_mcp::transport::TransportConfig;\n\nlet stdio = TransportConfig::Stdio;\nlet sse = TransportConfig::Sse {\n    url: \"http://localhost:8080/sse\".to_string(),\n};\nlet http = TransportConfig::Http {\n    url: \"http://localhost:8080/mcp\".to_string(),\n};\n```"
        },
        {
          "name": "::TransportConfig::transport_name",
          "line": 263,
          "signature": "pub fn transport_name(&self) -> &'static str;",
          "documentation": "Returns a human-readable name for this transport type.\n\n# Examples\n\n```\nuse forge_mcp::transport::TransportConfig;\n\nassert_eq!(TransportConfig::Stdio.transport_name(), \"stdio\");\n```"
        },
        {
          "name": "::TransportConfig::endpoint_url",
          "line": 285,
          "signature": "pub fn endpoint_url(&self) -> Option<&str>;",
          "documentation": "Returns the endpoint URL, if applicable.\n\nReturns `None` for stdio transport since it has no URL.\n\n# Examples\n\n```\nuse forge_mcp::transport::TransportConfig;\n\nlet sse = TransportConfig::Sse { url: \"http://localhost/sse\".to_string() };\nassert_eq!(sse.endpoint_url(), Some(\"http://localhost/sse\"));\n\nassert_eq!(TransportConfig::Stdio.endpoint_url(), None);\n```"
        },
        {
          "name": "::McpTransport",
          "line": 314,
          "signature": "#[async_trait]\npub trait McpTransport: Send + Sync {\n    /// Sends a JSON-encoded message through the transport.\n    ///\n    /// # Arguments\n    ///\n    /// * `message` - The JSON string to send.\n    ///\n    /// # Errors\n    ///\n    /// Returns `ForgeMcpError::TransportError` if the write fails.\n    async fn send(&self, message: &str) -> ForgeMcpResult<()>;\n\n    /// Receives the next JSON-encoded message from the transport.\n    ///\n    /// This method blocks (asynchronously) until a message is available\n    /// or the transport is closed.\n    ///\n    /// # Returns\n    ///\n    /// `Ok(Some(message))` if a message was received, `Ok(None)` if the\n    /// transport has been cleanly closed.\n    ///\n    /// # Errors\n    ///\n    /// Returns `ForgeMcpError::TransportError` if the read fails.\n    async fn receive(&self) -> ForgeMcpResult<Option<String>>;\n\n    /// Closes the transport, releasing any held resources.\n    ///\n    /// After calling `close()`, subsequent `send()` and `receive()` calls\n    /// should return errors.\n    ///\n    /// # Errors\n    ///\n    /// Returns `ForgeMcpError::TransportError` if the close fails.\n    async fn close(&self) -> ForgeMcpResult<()>;\n}",
          "documentation": "Trait for MCP message transport.\n\nAll transport implementations must be `Send + Sync` to support async\nusage from multiple tasks. The trait provides three operations: send a\nmessage, receive a message, and close the transport.\n\n# Implementors\n\n- [`StdioTransport`] -- stdin/stdout communication with child processes.\n- [`SseTransport`] -- Server-Sent Events for streaming responses.\n- [`HttpTransport`] -- Simple HTTP POST request/response.\n\n# Examples\n\n```\nuse forge_mcp::transport::McpTransport;\n\n// Transports are used through Box<dyn McpTransport> in McpClient/McpServer.\n// See McpClient::connect() for usage.\n```"
        },
        {
          "name": "::StdioTransport",
          "line": 364,
          "signature": "pub struct StdioTransport {\n\n}",
          "documentation": "Standard I/O transport.\n\nCommunicates with an MCP server via stdin/stdout of a child process.\nThis is the most common transport for locally spawned MCP servers.\n\n# Examples\n\n```\nuse forge_mcp::transport::StdioTransport;\n\nlet transport = StdioTransport::new();\n```"
        },
        {
          "name": "::StdioTransport::new",
          "line": 383,
          "signature": "pub fn new() -> Self;",
          "documentation": "Creates a new stdio transport backed by the current process streams.\n\n# Examples\n\n```\nuse forge_mcp::transport::StdioTransport;\n\nlet transport = StdioTransport::new();\n```"
        },
        {
          "name": "::StdioTransport::from_streams",
          "line": 391,
          "signature": "pub fn from_streams<R, W>(reader: R, writer: W) -> Self\n    where\n        R: AsyncRead + Send + 'static,\n        W: AsyncWrite + Send + 'static,;",
          "documentation": "Creates a stdio transport from custom async streams.\n\nThis is primarily useful for tests and embedded runtimes that provide\ntheir own stdin/stdout equivalents."
        },
        {
          "name": "::SseTransport",
          "line": 499,
          "signature": "pub struct SseTransport {\n\n}",
          "documentation": "Server-Sent Events transport.\n\nUses SSE for server-to-client streaming and HTTP POST for client-to-server\nrequests. This is the recommended transport for remote MCP servers.\n\n# Examples\n\n```\nuse forge_mcp::transport::SseTransport;\n\nlet transport = SseTransport::new(\"http://localhost:8080/sse\");\nassert_eq!(transport.url(), \"http://localhost:8080/sse\");\n```"
        },
        {
          "name": "::SseTransport::new",
          "line": 530,
          "signature": "pub fn new(url: impl Into<String>) -> Self;",
          "documentation": "Creates a new SSE transport targeting the given URL.\n\n# Arguments\n\n* `url` - The SSE endpoint URL.\n\n# Examples\n\n```\nuse forge_mcp::transport::SseTransport;\n\nlet transport = SseTransport::new(\"http://localhost:8080/sse\");\n```"
        },
        {
          "name": "::SseTransport::url",
          "line": 543,
          "signature": "pub fn url(&self) -> &str;",
          "documentation": "Returns the SSE endpoint URL."
        },
        {
          "name": "::HttpTransport",
          "line": 731,
          "signature": "pub struct HttpTransport {\n\n}",
          "documentation": "HTTP POST transport.\n\nUses HTTP POST for both requests and responses. This is the simplest\ntransport, suitable for stateless MCP servers.\n\n# Examples\n\n```\nuse forge_mcp::transport::HttpTransport;\n\nlet transport = HttpTransport::new(\"http://localhost:8080/mcp\");\nassert_eq!(transport.url(), \"http://localhost:8080/mcp\");\n```"
        },
        {
          "name": "::HttpTransport::new",
          "line": 756,
          "signature": "pub fn new(url: impl Into<String>) -> Self;",
          "documentation": "Creates a new HTTP transport targeting the given URL.\n\n# Arguments\n\n* `url` - The HTTP endpoint URL.\n\n# Examples\n\n```\nuse forge_mcp::transport::HttpTransport;\n\nlet transport = HttpTransport::new(\"http://localhost:8080/mcp\");\n```"
        },
        {
          "name": "::HttpTransport::url",
          "line": 766,
          "signature": "pub fn url(&self) -> &str;",
          "documentation": "Returns the HTTP endpoint URL."
        },
        {
          "name": "::create_transport",
          "line": 881,
          "signature": "pub fn create_transport(config: &TransportConfig) -> Box<dyn McpTransport>;",
          "documentation": "Creates a boxed transport from the given configuration.\n\nThis factory function selects the appropriate transport implementation\nbased on the `TransportConfig` variant.\n\n# Arguments\n\n* `config` - The transport configuration.\n\n# Returns\n\nA boxed trait object implementing `McpTransport`.\n\n# Examples\n\n```\nuse forge_mcp::transport::{TransportConfig, create_transport};\n\nlet transport = create_transport(&TransportConfig::Stdio);\n```"
        }
      ]
    },
    {
      "path": "forge-rs/crates/forge-mcp/src/types.rs",
      "sha256": "28883f34b58a04331ae6e596addb7a39e7b42faa34c8729629bd24fabb0f365d",
      "artifactSha256": "787fffe28168a49e5e518a00e303558585568f0b60e164f798deb516d27807de",
      "url": "/reference/source/forge-rs/crates/forge-mcp/src/types.rs.txt",
      "declarations": [
        {
          "name": "::McpToolDescriptor",
          "line": 47,
          "signature": "#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]\npub struct McpToolDescriptor {\n/// The unique tool name within the server.\n\npub name: String,\n/// Human-readable description of what the tool does.\n\npub description: String,\n/// JSON Schema for the tool's input parameters.\n\n#[serde(rename = \"inputSchema\")]\npub input_schema: serde_json::Value\n}",
          "documentation": "Describes a tool exposed by an MCP server.\n\n`McpToolDescriptor` represents a single tool listing returned by the\n`tools/list` method. It carries the tool's name, a human-readable\ndescription, and a JSON Schema defining the expected input parameters.\n\n# Examples\n\n```\nuse forge_mcp::types::McpToolDescriptor;\nuse serde_json::json;\n\nlet tool = McpToolDescriptor {\n    name: \"read_file\".to_string(),\n    description: \"Read a file from disk\".to_string(),\n    input_schema: json!({\n        \"type\": \"object\",\n        \"properties\": {\n            \"path\": { \"type\": \"string\" }\n        },\n        \"required\": [\"path\"]\n    }),\n};\nassert_eq!(tool.name, \"read_file\");\n```"
        },
        {
          "name": "::McpResource",
          "line": 80,
          "signature": "#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]\npub struct McpResource {\n/// The resource URI (e.g., `file:///path` or `https://...`).\n\npub uri: String,\n/// Human-readable resource name.\n\npub name: String,\n/// Optional description of the resource.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub description: Option<String>,\n/// Optional MIME type of the resource content.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\n#[serde(rename = \"mimeType\")]\npub mime_type: Option<String>\n}",
          "documentation": "Describes a resource exposed by an MCP server.\n\nResources are read-only data sources (files, database records, API\nresponses) that the server makes available to the client.\n\n# Examples\n\n```\nuse forge_mcp::types::McpResource;\n\nlet resource = McpResource {\n    uri: \"file:///project/README.md\".to_string(),\n    name: \"README.md\".to_string(),\n    description: Some(\"Project README file\".to_string()),\n    mime_type: Some(\"text/markdown\".to_string()),\n};\nassert_eq!(resource.uri, \"file:///project/README.md\");\n```"
        },
        {
          "name": "::McpPrompt",
          "line": 123,
          "signature": "#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]\npub struct McpPrompt {\n/// Unique prompt name within the server.\n\npub name: String,\n/// Optional description of the prompt's purpose.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub description: Option<String>,\n/// Arguments that the prompt template accepts.\n\n#[serde(default)]\npub arguments: Vec<McpPromptArgument>\n}",
          "documentation": "Describes a prompt template exposed by an MCP server.\n\nPrompts are reusable templates that accept arguments and produce messages\nfor the language model. They enable servers to provide canned workflows.\n\n# Examples\n\n```\nuse forge_mcp::types::{McpPrompt, McpPromptArgument};\n\nlet prompt = McpPrompt {\n    name: \"summarize\".to_string(),\n    description: Some(\"Summarize a document\".to_string()),\n    arguments: vec![\n        McpPromptArgument {\n            name: \"text\".to_string(),\n            description: Some(\"The text to summarize\".to_string()),\n            required: true,\n        },\n    ],\n};\nassert_eq!(prompt.arguments.len(), 1);\nassert!(prompt.arguments[0].required);\n```"
        },
        {
          "name": "::McpPromptArgument",
          "line": 149,
          "signature": "#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]\npub struct McpPromptArgument {\n/// Argument name.\n\npub name: String,\n/// Optional description of the argument.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub description: Option<String>,\n/// Whether this argument is required.\n\n#[serde(default)]\npub required: bool\n}",
          "documentation": "An argument to an MCP prompt template.\n\n# Examples\n\n```\nuse forge_mcp::types::McpPromptArgument;\n\nlet arg = McpPromptArgument {\n    name: \"language\".to_string(),\n    description: Some(\"Target programming language\".to_string()),\n    required: false,\n};\nassert!(!arg.required);\n```"
        },
        {
          "name": "::McpRequest",
          "line": 185,
          "signature": "#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]\npub struct McpRequest {\n/// JSON-RPC version string (always \"2.0\").\n\npub jsonrpc: String,\n/// Request identifier for matching responses to requests.\n\npub id: McpRequestId,\n/// The MCP method to invoke (e.g., `tools/list`, `tools/call`).\n\npub method: String,\n/// Optional method parameters.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub params: Option<serde_json::Value>\n}",
          "documentation": "JSON-RPC 2.0 request envelope for MCP communication.\n\nMCP uses JSON-RPC 2.0 as its wire protocol. Every client-to-server message\nis wrapped in this envelope with a method name and optional parameters.\n\n# Examples\n\n```\nuse forge_mcp::types::{McpRequest, McpRequestId};\nuse serde_json::json;\n\nlet req = McpRequest {\n    jsonrpc: \"2.0\".to_string(),\n    id: McpRequestId::Number(1),\n    method: \"tools/list\".to_string(),\n    params: Some(json!({})),\n};\nlet json = serde_json::to_string(&req).unwrap();\nassert!(json.contains(\"tools/list\"));\n```"
        },
        {
          "name": "::McpRequest::new",
          "line": 220,
          "signature": "pub fn new(\n        id: McpRequestId,\n        method: impl Into<String>,\n        params: Option<serde_json::Value>,\n    ) -> Self;",
          "documentation": "Creates a new JSON-RPC 2.0 request.\n\n# Arguments\n\n* `id` - The request identifier.\n* `method` - The MCP method name.\n* `params` - Optional parameters for the method.\n\n# Examples\n\n```\nuse forge_mcp::types::{McpRequest, McpRequestId};\nuse serde_json::json;\n\nlet req = McpRequest::new(\n    McpRequestId::Number(1),\n    \"tools/list\",\n    Some(json!({})),\n);\nassert_eq!(req.method, \"tools/list\");\nassert_eq!(req.jsonrpc, \"2.0\");\n```"
        },
        {
          "name": "::McpResponse",
          "line": 253,
          "signature": "#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]\npub struct McpResponse {\n/// JSON-RPC version string (always \"2.0\").\n\npub jsonrpc: String,\n/// The request identifier this response corresponds to.\n\npub id: McpRequestId,\n/// The successful result, if the request succeeded.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub result: Option<serde_json::Value>,\n/// The error object, if the request failed.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub error: Option<McpErrorObject>\n}",
          "documentation": "JSON-RPC 2.0 response envelope for MCP communication.\n\nEither `result` or `error` is present, never both.\n\n# Examples\n\n```\nuse forge_mcp::types::{McpResponse, McpRequestId};\nuse serde_json::json;\n\nlet resp = McpResponse {\n    jsonrpc: \"2.0\".to_string(),\n    id: McpRequestId::Number(1),\n    result: Some(json!({\"tools\": []})),\n    error: None,\n};\nassert!(resp.is_success());\n```"
        },
        {
          "name": "::McpResponse::is_success",
          "line": 268,
          "signature": "pub fn is_success(&self) -> bool;",
          "documentation": "Returns `true` if this response indicates success."
        },
        {
          "name": "::McpResponse::is_error",
          "line": 273,
          "signature": "pub fn is_error(&self) -> bool;",
          "documentation": "Returns `true` if this response indicates an error."
        },
        {
          "name": "::McpErrorObject",
          "line": 295,
          "signature": "#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]\npub struct McpErrorObject {\n/// The JSON-RPC error code.\n\npub code: i64,\n/// Human-readable error message.\n\npub message: String,\n/// Optional additional error data.\n\n#[serde(skip_serializing_if = \"Option::is_none\")]\npub data: Option<serde_json::Value>\n}",
          "documentation": "JSON-RPC 2.0 error object.\n\nCarries an error code, human-readable message, and optional structured data.\n\n# Examples\n\n```\nuse forge_mcp::types::McpErrorObject;\n\nlet err = McpErrorObject {\n    code: -32601,\n    message: \"method not found\".to_string(),\n    data: None,\n};\nassert_eq!(err.code, -32601);\n```"
        },
        {
          "name": "::McpRequestId",
          "line": 320,
          "signature": "#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]\n#[serde(untagged)]\npub enum McpRequestId {\n    /// Numeric request identifier.\n    Number(u64),\n    /// String request identifier.\n    Str(String),\n    /// Null identifier (for notifications).\n    Null,\n}",
          "documentation": "A JSON-RPC 2.0 request/response identifier.\n\nPer the JSON-RPC spec, the id can be a number, a string, or null.\n\n# Examples\n\n```\nuse forge_mcp::types::McpRequestId;\n\nlet num_id = McpRequestId::Number(42);\nlet str_id = McpRequestId::Str(\"req-abc\".to_string());\nlet null_id = McpRequestId::Null;\n```"
        },
        {
          "name": "::McpCapabilities",
          "line": 353,
          "signature": "#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]\npub struct McpCapabilities {\n/// Whether tool listing and invocation is supported.\n\n#[serde(default)]\npub tools: bool,\n/// Whether resource listing and reading is supported.\n\n#[serde(default)]\npub resources: bool,\n/// Whether prompt listing and retrieval is supported.\n\n#[serde(default)]\npub prompts: bool\n}",
          "documentation": "Capabilities advertised during the MCP initialization handshake.\n\nBoth client and server advertise their capabilities during the `initialize`\nexchange. The intersection determines which features are available for the\nsession.\n\n# Examples\n\n```\nuse forge_mcp::types::McpCapabilities;\n\nlet caps = McpCapabilities {\n    tools: true,\n    resources: false,\n    prompts: true,\n};\nassert!(caps.tools);\nassert!(!caps.resources);\n```"
        },
        {
          "name": "::McpCapabilities::all",
          "line": 378,
          "signature": "pub fn all() -> Self;",
          "documentation": "Creates capabilities with all features enabled.\n\n# Examples\n\n```\nuse forge_mcp::types::McpCapabilities;\n\nlet caps = McpCapabilities::all();\nassert!(caps.tools);\nassert!(caps.resources);\nassert!(caps.prompts);\n```"
        },
        {
          "name": "::McpCapabilities::none",
          "line": 398,
          "signature": "pub fn none() -> Self;",
          "documentation": "Creates capabilities with no features enabled.\n\n# Examples\n\n```\nuse forge_mcp::types::McpCapabilities;\n\nlet caps = McpCapabilities::none();\nassert!(!caps.tools);\nassert!(!caps.resources);\nassert!(!caps.prompts);\n```"
        }
      ]
    }
  ]
}
