rustcrates.git / mcp / CLAUDE.md

For agents, on top of README.md, which they read first.

  • rmcp types stay out of the public API. CommandServer, ServerIdentity, CommandTool and the error types are this crate's own; a consumer that has to use rmcp::… means something is missing here.
  • The enum must be internally tagged (#[serde(tag = "…")]). Reflection reads the tag's const from each variant's schema and refuses an enum without one (ReflectError::UntaggedVariant) rather than guessing a name.
  • A handler's Err and a call with bad arguments are tool results with is_error, not protocol errors, so the model sees the message and can correct the call. Only an unknown tool name is a protocol error.
  • The rmcp pin is the deizel/rust-sdk fork; the reason is beside the pin in ../Cargo.toml.