Module integration

Module integration 

Source
Expand description

Integration prelude for LLM framework integrations (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

// Example: Generic function that works with any transport type
pub fn process_tool_with_client<T: Transport + 'static>(
    tool: Tool,
    client: Client<T>,
) {
    // Integration code here
    println!("Tool name: {}", tool.name);
}

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

Traits§

Transport
The core trait for all transport implementations.

Type Aliases§

Content
Backward compatibility alias for ContentBlock.