Back to feed
Dev.to
Dev.to
7/18/2026
I Almost Hand-Rolled JSON-RPC for an MCP Server. Eight Tools Later I'm Glad I Didn't.

I Almost Hand-Rolled JSON-RPC for an MCP Server. Eight Tools Later I'm Glad I Didn't.

Short summary

A developer compares hand-rolling JSON-RPC for an MCP server against using FastMCP's decorator API, finding the decorator approach eliminates boilerplate that scales linearly with tool count. With 8 tools, the low-level path requires manual schema registration, dispatch matching, and response wrapping — all protocol plumbing disconnected from actual tool logic. FastMCP derives JSON Schema from Python type hints and docstrings, making adding a tool as simple as writing a function with @mcp.tool(). Two real gotchas: implicit return-type coercion can cause subtle bugs, and schema generation from optional parameters needs careful validation.

  • FastMCP's @mcp.tool() decorator eliminates boilerplate that scales linearly with tool count vs hand-rolled JSON-RPC
  • Type hints become JSON Schema, docstrings become tool descriptions — no manual sync needed
  • Watch for implicit return-type coercion and unvalidated optional parameters when using FastMCP

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more