#llm #mcp #type

no-std turbomcp-types

Core types for TurboMCP - the foundation of the MCP SDK

20 releases (stable)

Uses new Rust 2024

new 3.0.14 Apr 15, 2026
3.0.13 Apr 14, 2026
3.0.10 Mar 27, 2026
3.0.0-beta.5 Feb 24, 2026
3.0.0-beta.3 Jan 22, 2026

#2092 in Encoding

Download history 121/week @ 2026-03-04 121/week @ 2026-03-11 76/week @ 2026-03-18 168/week @ 2026-03-25 204/week @ 2026-04-01 197/week @ 2026-04-08

677 downloads per month
Used in 28 crates (5 directly)

MIT license

135KB
2.5K SLoC

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 support
  • alloc: Allocator support without full std (for no_std + alloc environments)
  • schema: JSON Schema generation for tool input schemas

Design Principles

  1. Single Source of Truth: These types are the canonical definitions
  2. Ergonomic by Default: Common operations are one-liners
  3. MCP 2025-11-25 Compliant: Full spec support
  4. no_std Compatible: Works in WASM and embedded environments

Quick Start

use turbomcp_types::*;

// Create a tool result
let result = ToolResult::text("Hello, world!");

// Create an error result
let error = ToolResult::error("Something went wrong");

// Create a JSON result with structured content
let json_result = ToolResult::json(&serde_json::json!({"key": "value"})).unwrap();

// Create a resource result
let resource = ResourceResult::text("file:///example.txt", "File contents here");

// Create a prompt result
let prompt = PromptResult::user("Hello!")
    .add_assistant("How can I help?")
    .with_description("A greeting prompt");

no_std Usage

[dependencies]
turbomcp-types = { version = "3.0", default-features = false, features = ["alloc"] }

License

MIT

Dependencies

~1–2.5MB
~47K SLoC