Skip to main content

Module mcp

Module mcp 

Source
Expand description

The Model Context Protocol surface.

Three tools, one per thing the CLI already does: run the checks, list the configured rules, explain one. An agent host launches lanekeep server --protocol mcp and calls them; the transport is the same JSON-RPC this crate already speaks, line-delimited instead of header-delimited.

§What the tools return

The agent reporter’s text, unchanged. That format exists precisely for this consumer — it groups by rule, states the remediation once rather than per occurrence, and shows a good and bad example — and re-rendering violations into a bespoke JSON shape here would be a second answer to a question §11 already answered.

§A failing tool is not a failing call

MCP separates the two, and the distinction is load-bearing. A rule that throws, or a config that will not load, is a result the model should see and act on — it comes back as isError: true with the message as content. A JSON-RPC error is for the host, not the model: no such tool, malformed arguments. Reporting a rule failure as a JSON-RPC error hides it from the thing best placed to fix it.

Traits§

Tools
What the host can ask lanekeep to do.

Functions§

catalogue
The tool catalogue, as tools/list returns it.
content
A tool result, successful or not.
serve
Serve MCP against input and output until the host disconnects.