Build an MCP server
Stage 3 of 5v1 · afc51c9e

Publish and invoke tools

Add discovery and validated execution for echo and add.

Discoverable tools

Implement tools/list with two descriptors ordered by name: add and echo. Copy the names, descriptions, and schemas shown by the tests exactly; a schema is part of the public interface.

tools/call receives params.name and params.arguments. add accepts two numbers and represents their sum as JSON text without unnecessary zeros. echo accepts a string. Both return content with one text block and isError:false.

Do not confuse protocol errors with tool errors. In the final stage, invalid arguments will become a tool result with isError:true.

Acceptance criteria

  • The list and its properties have stable order.
  • Both tools produce MCP content.
  • Previous stages remain supported.