turbomcp-types
Core types for the TurboMCP SDK - the foundation of MCP server development.
Overview
This crate provides all shared types used across the TurboMCP ecosystem:
- Content types:
Content,TextContent,ImageContent, etc. - Result types:
ToolResult,ResourceResult,PromptResult - Definition types:
Tool,Resource,Prompt,ServerInfo - Conversion traits:
IntoToolResult,IntoResourceResult,IntoPromptResult
For error handling, use turbomcp_core::error::{McpError, McpResult}.
Features
std(default): Enable standard library supportalloc: Allocator support without full std (for no_std + alloc environments)schema: JSON Schema generation for tool input schemas
Design Principles
- Single Source of Truth: These types are the canonical definitions
- Ergonomic by Default: Common operations are one-liners
- MCP 2025-11-25 Compliant: Full spec support
- no_std Compatible: Works in WASM and embedded environments
Quick Start
use *;
// Create a tool result
let result = text;
// Create an error result
let error = error;
// Create a JSON result with structured content
let json_result = json.unwrap;
// Create a resource result
let resource = text;
// Create a prompt result
let prompt = user
.add_assistant
.with_description;
no_std Usage
[]
= { = "3.0", = false, = ["alloc"] }
License
MIT