Module integration

Module integration 

Source
Expand description

Integration prelude for LLM framework integrations (Rig, Langchain, etc.)

This module provides a comprehensive re-export of types commonly needed when integrating MCP clients with LLM frameworks. It includes everything from the standard prelude plus additional abstractions that are particularly useful for building agent integrations.

§Usage

For LLM framework integrations, use this instead of the standard prelude:

use turbomcp_client::integration::*;

// Now available:
// - Client<T> and ClientBuilder for MCP connections
// - Transport trait for generic bounds in agent definitions
// - Tool, Resource, Prompt for protocol types
// - All handler types for server-initiated requests
// - Plugin system for middleware and metrics

pub fn register_mcp_tool<T: Transport + 'static>(
    agent_builder: AgentBuilder,
    tool: Tool,
    client: Client<T>,
) -> AgentBuilder {
    // Integration code here
    agent_builder
}

Re-exports§

pub use crate::ClientBuilder;
pub use crate::prelude::*;

Structs§

CreateMessageRequest
Create message request (for LLM sampling)
CreateMessageResult
Create message result
Prompt
Prompt definition per MCP 2025-06-18 specification
Resource
Resource definition per MCP 2025-06-18 specification
Tool
Represents a tool that can be executed by an MCP server, as per the MCP 2025-06-18 specification.

Traits§

Transport
The core trait for all transport implementations.

Type Aliases§

Content
Compatibility alias for the old Content enum