batfish-q-mcp

v0.2.0
io.github.martimy/batfish-q-mcp Checked 3 hours ago Published 20 days ago

An MCP server exposing Batfish tools so AI assistants can query network configs in plain language.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

batfish_find_questions Batfish Find Questions

Find catalog questions from a plain-language query. ``query`` is the user's own wording, e.g. ``"standby gateway"``, ``"traffic going in circles"``, or ``"which firewall rule is blocking"``. It is matched against question names, descriptions, categories, tags, synonyms, input names/descriptions/allowed values, and output columns. Returns ``{query, count, total_matches, results}`` where each result is ``{fun, name, category, description, tags, synonyms, supports_differential, differential_only, score, matched_on}``. Results are ranked by relevance and capped at ``limit`` (default 5). Use ``b…

ParameterTypeDescription
query *string
limitinteger

batfish_list_questions Batfish List Questions

List Batfish questions from the curated catalog. Returns one dict per question: ``{category, category_description, fun, name, description, tags, synonyms, supports_differential, differential_only, output_columns, inputs, type?}``. - ``description`` is a one-line summary; ``tags`` are Batfish's tags; ``synonyms`` are plain-language search terms. - ``output_columns`` lists only column names; call ``batfish_get_question`` for their types and descriptions. - Each input is ``{name, type, required, hint?, fields?, placeholder?, example?}``. ``required`` is true when the input must be supplie…

ParameterTypeDescription
category

batfish_get_question Batfish Get Question

Return full metadata for one question, including output columns. ``fun`` is a catalog question name (see ``batfish_list_questions``). Returns ``{category, category_description, fun, name, description, long_description, tags, synonyms, supports_differential, differential_only, output_columns, inputs, type?}``: - ``output_columns`` is a list of ``{name, type, description}`` objects describing the answer table. - each input includes its catalog ``type`` and ``required`` flag plus template details when available: ``description``, ``display_name``, ``default``, ``allowed_values`` (strings,…

ParameterTypeDescription
fun *string

batfish_list_snapshots Batfish List Snapshots

List snapshots of a Batfish network. If ``network`` is given, the session is pointed at it first (``set_network``); otherwise the session's current network is used.

ParameterTypeDescription
network

batfish_delete_snapshot Batfish Delete Snapshot

Delete a Batfish snapshot. - ``name``: the snapshot name to delete (sanitized with ``safe_snapshot_name``). - ``network``: the network the snapshot lives in; if given, the session is pointed at it first. Returns ``{name}`` — the name that was deleted.

ParameterTypeDescription
name *string
network

batfish_upload_snapshot Batfish Upload Snapshot

Upload a Batfish snapshot zip, base64-encoded. The name is sanitized with ``safe_snapshot_name`` (Batfish allows only letters, digits, '-' and '_'). Unless ``overwrite`` is true, an existing snapshot of that name is kept and a unique name is chosen (``base``, ``base_1``, ...). If ``network`` is given, the session is pointed at it first. Returns the name actually used.

ParameterTypeDescription
name *string
zip_base64 *string
network
overwriteboolean

batfish_run_question Batfish Run Question

Run a Batfish question and return its JSON-safe rows. - ``fun`` is the pybatfish question function name (see ``batfish_list_questions``); ``options`` is its keyword-argument dict. - ``snapshot`` runs the question on that snapshot (the session's current snapshot otherwise). - ``reference_snapshot`` + ``snapshot`` runs a differential question comparing the two; both are required for differential questions. In the answer, ``Snapshot_*`` columns come from ``snapshot`` (the snapshot under test) and ``Reference_*`` columns come from ``reference_snapshot`` (the baseline). - ``network`` p…

ParameterTypeDescription
fun *string
debugboolean
max_rowsinteger
network
options
reference_snapshot
snapshot
trace_detailstring

batfish_list_assertions Batfish List Assertions

List the assertions available (registry + live pybatfish names). Returns ``{snapshot, answer, specs}``: - ``snapshot`` / ``answer``: assertion names available in the installed pybatfish, grouped by how they are called (session-bound vs answer-based). - ``specs``: the curated registry ``{type: {label, description, group, phase, call, needs_question, params}}`` — each param is ``{name, type, optional, hint}``, where ``hint`` describes complex types (e.g. ``HeaderConstraints``) so you can build ``params``.

batfish_run_assertion Batfish Run Assertion

Validate and run one assertion on a snapshot. - ``name``: assertion type (see ``batfish_list_assertions``). - ``params``: its parameters, e.g. ``{"headers": {"dstIps": "8.8.8.8", "ipProtocols": ["TCP"], "dstPorts": "443"}}`` for ``assert_flows_succeed``. - ``question``: ``{"fun": ..., "options": {...}}`` — required for answer-based assertions (``assert_zero_results``, ``assert_num_results``, ``assert_min_results``); the question is run first and its answer checked. - ``snapshot`` / ``network``: run on that snapshot (and network first), otherwise the session's current ones. - ``deb…

ParameterTypeDescription
name *string
debugboolean
network
params
question
snapshot

batfish_run_assertion_suite Batfish Run Assertion Suite

Validate and run an assertion suite (YAML text) on a snapshot. ``suite_yaml`` uses the suite schema (see ``examples/assertions.yaml``):: version: 1 assertions: - type: assert_flows_succeed params: startLocation: as1border1 headers: dstIps: 2.128.0.101 ipProtocols: [TCP] dstPorts: "443" Header fields follow Batfish rules: ``srcIps``/``dstIps`` accept IPs, prefixes, and node names; ``srcPorts``/``dstPorts`` are string specs such as ``"443"``. Without ``ipProtocols``, Batfish tests ICMP. Prefer node names, interface…

ParameterTypeDescription
suite_yaml *string
debugboolean
network
snapshot

batfish_fork_snapshot Batfish Fork Snapshot

Fork a snapshot, optionally failing (deactivating) nodes/interfaces. - ``base_name``: the snapshot to fork. - ``name``: the fork's name (sanitized with ``safe_snapshot_name``); defaults to ``<base>_Fail``. Unless ``overwrite`` is true, an existing name is kept and a unique one is chosen (``name``, ``name_1``, ...). - ``failed_nodes``: node names to deactivate in the fork. - ``failed_interfaces``: interfaces to deactivate, each as a ``node[interface]`` string (for example ``"r1[Gi0/0]"``) or as a ``{"hostname": "r1", "interface": "Gi0/0"}`` mapping. Bare node names are rejected; us…

ParameterTypeDescription
base_name *string
failed_interfaces
failed_nodes
name
network
overwriteboolean

batfish_get_topology Batfish Get Topology

Return the topology graph of a snapshot as nodes/edges. - ``kind="layer3"`` (default): L3 links from ``layer3Edges`` (node — interface <-> interface — node, so edges carry a ``title`` like ``"r1 (Gi0/0) <---> r2 (Gi0/0)"``). - ``kind="routing"``: routing adjacencies from ``bgpEdges``. Returns ``{kind, snapshot, node_count, edge_count, nodes, edges}``.

ParameterTypeDescription
kindstring
network
snapshot