formalmethods.dev

§ 03 · for agents

The same lab, over MCP.

Everything in the field guide and workbench is callable by your AI agents at one endpoint — stateless JSON-RPC 2.0, no sessions. Point an MCP client at /api/mcp.

endpoint

POST /api/mcp

JSON-RPC 2.0 over Streamable HTTP, stateless: every request stands alone, no session handshake required. The five tools are the same engine the workbench above runs — a verdict you read here and a verdict your agent reads over MCP can never disagree.

  • —protocol 2025-06-18; notifications get 202 Accepted
  • —batches (JSON arrays) are answered with arrays
  • —results carry structuredContent for agents and pretty JSON for humans
curl -s https://formalmethods.dev/api/mcp \
  -H 'content-type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize"}'

# → {"jsonrpc":"2.0","id":1,"result":{
#     "protocolVersion":"2025-06-18",
#     "capabilities":{"tools":{"listChanged":false}},
#     "serverInfo":{"name":"formalmethods-mcp", ...}}}
curl -s https://formalmethods.dev/api/mcp \
  -H 'content-type: application/json' \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call",
       "params":{"name":"check_ltl",
                 "arguments":{"formula":"G (request -> F response)",
                              "trace":[["request"],["timeout"],["timeout"]]}}}'

# → result.structuredContent.satisfies === false  (a failing test, machine-read)

the toolbox · six tools

method: tools/list

  1. a. check_ltl

    Check an LTL property on a finite trace

    args: formula, trace

    Evaluate an LTL formula over a finite trace (a test case / log) under finite-trace (LTLf) semantics. Returns the verdict plus a truth table of every subformula at every position, which makes counterexamples easy to read. Supported syntax: atoms (identifiers), true, false, !, &&, ||, ->, <->, X (next), G (globally), F (finally), U (until), W (weak until), R (release).

  2. b. model_check

    Model check an LTL property on a Kripke structure

    args: formula, model

    Check an LTL property against a Kripke structure (states + transitions + labels) under infinite-run semantics. Enumerates every lasso (simple prefix + cycle) up to a depth bound. Returns verdict 'violated' (with counterexample lassos), 'holds' (exhaustive: full depth reached without truncation), or 'incomplete' (depth bound or path budget was reached). Dead-end states are treated as stuttering forever.

  3. c. falsify_property

    Falsify an LTL property with random traces

    args: formula, atoms

    Property-based testing for LTL: generate random finite traces over the given atoms, check the property under LTLf semantics, and when a violation is found, shrink it (drop positions, then atoms) to a minimal readable counterexample. Deterministic given a seed.

  4. d. analyze_coverage

    Measure state/transition coverage of traces

    args: model, traces

    Given a Kripke structure and a set of test traces (sequences of state ids), report state and transition coverage: what was reached, what is missing, and the percentages. A negative metric: it proves absence of testing, never presence of correctness.

  5. e. explain_concept

    Explain a formal-methods concept

    args: —

    Explain formal-methods-for-testing concepts (specification, LTL, Kripke structures, model checking, bounded model checking, property-based testing, coverage, runtime verification, test generation, proving). Call with no concept for a one-line index of available topics.

  6. f. read_skills_guide

    The doing-guide (SKILLS.md)

    args: —

    The lab's doing-guide as markdown: how to write LTL properties (grammar + property patterns), pick the right instrument by question, read verdicts honestly, build Kripke models, call these tools over MCP, and the workflow recipes (spec-first, triage, CI, liveness). Read this before your first tools/call — it is the operating manual for everything else here.

Honesty is a protocol feature. No tool ever claims more than it checked: bounded results say incomplete, random campaigns say not falsified, and only an exhaustive enumeration is allowed to say holds. Your agents will quote these verbatim — they have been designed so they can.

wired elsewhere · run the instruments by hand · the doing-guide · per-language recipes