batfish-q-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| BATFISH_SERVER | No | The Batfish server host. Set this if Batfish runs somewhere other than 127.0.0.1. | 127.0.0.1 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server exposes a curated catalog of 60 Batfish questions plus snapshot, assertion, topology, and failure-testing tools.
Workflow:
Call batfish_list_snapshots to confirm the snapshot and network.
Browse batfish_list_questions for the full catalog. If you know the topic but not the Batfish name, call batfish_find_questions with the user's words (for example "standby gateway", "traffic going in circles", or "which ACL rule blocks this").
Call batfish_get_question(fun) for full descriptions, output columns, defaults, and allowed values.
Call batfish_run_question with its
funand anoptionsdict.
Each catalog entry includes a one-line description, tags, synonyms, output
column names, a category description, required/optional inputs, and structured
type metadata (fields, placeholder, example) for complex values such as
HeaderConstraints. Inputs marked required: true must be supplied; other
inputs may be omitted. batfish_get_question adds long descriptions, typed
output columns, input descriptions, defaults, allowed values, and field specs.
Discovery tools work without a running Batfish; the metadata is checked in.
Decision guide:
Did Batfish parse the snapshot? initIssues, fileParseStatus, parseWarning.
Need configuration facts (interfaces, ACLs, BGP/OSPF config)? nodeProperties, interfaceProperties, *Configuration, *Properties, namedStructures.
Need the topology graph? Use batfish_get_topology; for raw links use layer3Edges or userProvidedLayer1Edges.
Need the routing table or a route lookup? routes (RIB), bgpRib (BGP table), lpmRoutes (which route wins for an IP).
Need end-to-end connectivity? traceroute (one source, one direction), reachability (find successful flows), bidirectionalReachability (round trip), detectLoops, *MultipathConsistency.
Need to know whether traffic is permitted? testFilters. Need to find which flows or lines match? searchFilters or findMatchingFilterLines. Need shadowed/unreachable rules? filterLineReachability.
Need protocol session health? bgpSessionStatus (up/down) vs bgpSessionCompatibility (why misconfigured); same pattern for OSPF.
Need a redundant gateway? hsrpProperties or vrrpProperties.
Need tunnels or overlays? ipsec*, vxlan*, evpn*.
Need to debug a specifier? resolve*.
Need to compare snapshots? Any question with
supports_differential: truecan run with bothsnapshotandreference_snapshot; compareFilters and differentialReachability are differential-only. In a differential answer,Snapshot_*columns come fromsnapshot(the snapshot under test) andReference_*columns come fromreference_snapshot(the baseline).
If two questions still fit, say so and explain the difference rather than
guessing. Pass network on the first call if the server has no network set.
Question failures come back as {status: "error", code, message} instead of a
Java work-item log; pass debug: true to include the raw log. Reachability
answers compact trace columns to disposition, node path, and hop count by
default; set trace_detail: "full" when every hop-by-hop step is needed, or
"none" to drop traces. max_rows caps large answers (default 50, 0 for no
limit). Header values are Batfish specifiers: srcIps/dstIps accept IPs,
prefixes, node names, or named IP spaces, while srcPorts/dstPorts require
string specs such as "443". Batfish returns representative flows for broad
headers: a prefix such as 10.0.0.0/24 may yield a network or broadcast source.
Prefer node names, interface locations, or explicit host IPs for realistic
examples. When an assertion omits ipProtocols, Batfish tests ICMP; set
ipProtocols and dstPorts for service-level checks.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
| logging | {} |
| prompts | {
"listChanged": true
} |
| resources | {
"subscribe": false,
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| batfish_find_questionsA | Find catalog questions from a plain-language query.
Returns Use |
| batfish_list_questionsA | List Batfish questions from the curated catalog. Returns one dict per question:
Pass a category name to filter; omit it for the full catalog. This tool uses checked-in metadata and does not contact Batfish. |
| batfish_get_questionA | Return full metadata for one question, including output columns.
Returns
Raises |
| batfish_list_snapshotsA | List snapshots of a Batfish network. If |
| batfish_delete_snapshotB | Delete a Batfish snapshot.
Returns |
| batfish_upload_snapshotB | Upload a Batfish snapshot zip, base64-encoded. The name is sanitized with |
| batfish_run_questionA | Run a Batfish question and return its JSON-safe rows.
Returns Header values are Batfish specifiers: |
| batfish_list_assertionsA | List the assertions available (registry + live pybatfish names). Returns
|
| batfish_run_assertionA | Validate and run one assertion on a snapshot.
Returns Header fields follow Batfish rules: |
| batfish_run_assertion_suiteA | Validate and run an assertion suite (YAML text) on a snapshot.
Header fields follow Batfish rules: All-or-nothing: if the suite is invalid, nothing runs and the result is
|
| batfish_fork_snapshotA | Fork a snapshot, optionally failing (deactivating) nodes/interfaces.
Returns |
| batfish_get_topologyA | Return the topology graph of a snapshot as nodes/edges.
Returns |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 12 tools
Most tools have clearly distinct roles: question discovery (find/list/get), execution (run_question), assertion workflows (list/run/run_suite), and snapshot lifecycle (upload/list/delete/fork). The closest overlap is batfish_find_questions vs batfish_list_questions (both enumerate the catalog) and batfish_run_assertion vs batfish_run_assertion_suite, but the descriptions make the search-vs-browse and single-vs-batch distinctions reasonably clear.
Every tool follows the same batfish_verb_noun snake_case pattern: list_questions, get_question, find_questions, run_question, list_snapshots, delete_snapshot, upload_snapshot, fork_snapshot, get_topology, list_assertions, run_assertion, run_assertion_suite. Verbs are used consistently for their semantic (list vs get vs find vs upload vs fork).
12 tools is well within the ideal 3-15 range and each one earns its place: four discovery tools, one executor, one topology tool, and six lifecycle/assertion tools. Nothing feels redundant enough to remove, and nothing is missing that would push the count higher.
The surface covers the core Batfish workflow end-to-end: discover questions/assertions, run them, inspect topology, and manage snapshots (upload, list, fork, delete) including differential runs. The main gap is network lifecycle — there is no tool to list, create, or delete Batfish networks, so agents must already know a network name and pass it to other tools rather than discovering it.