Skip to main content
Glama

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
BATFISH_SERVERNoThe 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:

  1. Call batfish_list_snapshots to confirm the snapshot and network.

  2. 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").

  3. Call batfish_get_question(fun) for full descriptions, output columns, defaults, and allowed values.

  4. Call batfish_run_question with its fun and an options dict.

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: true can run with both snapshot and reference_snapshot; compareFilters and differentialReachability are differential-only. In a differential answer, Snapshot_* columns come from snapshot (the snapshot under test) and Reference_* columns come from reference_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

CapabilityDetails
tools
{
  "listChanged": true
}
logging
{}
prompts
{
  "listChanged": true
}
resources
{
  "subscribe": false,
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
batfish_find_questionsA

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 batfish_get_question(fun) for full input/output details. This tool uses checked-in metadata and does not contact Batfish.

batfish_list_questionsA

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 supplied (not optional and has no default).

  • supports_differential is true when the question accepts a reference_snapshot. differential_only marks the two questions (compareFilters and differentialReachability) that can only be run differentially; type is retained on those entries.

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.

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, or {value, description} objects), field_specs for structured values, and min_length.

  • TYPE_HINTS add hint/fields/placeholder/example for complex values such as HeaderConstraints.

Raises ValueError for an unknown fun, listing the known names.

batfish_list_snapshotsA

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.

batfish_delete_snapshotB

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.

batfish_upload_snapshotB

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.

batfish_run_questionA

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 points the session at a network first, if given.

  • debug=True includes the raw Batfish exception log in the response.

  • trace_detail controls trace columns (Traces, Snapshot_Traces, Reference_Traces): "summary" (default) keeps disposition, node path, and hop count; "none" drops the trace columns but keeps the trace counts; "full" returns the original hop-by-hop traces.

  • max_rows caps the number of returned rows (default 50). Use 0 for no limit; total_rows, returned_rows, and truncated report whether the cap was applied.

  • A named snapshot/reference_snapshot must exist in the network; otherwise a ValueError lists the available snapshots.

Returns {fun, snapshot, reference_snapshot, status, rows, removed_columns, total_rows, returned_rows, truncated} where rows is a list of row dicts. A differentialReachability answer also includes trace_columns, which maps Snapshot_Traces to the snapshot argument and Reference_Traces to reference_snapshot. A Batfish failure returns {status: "error", code, message, rows: []} instead of raising; known codes include SNAPSHOT_INCOMPATIBLE, INVALID_ARGUMENT, INVALID_PORT_SPEC, and BIDIRECTIONAL_REQUIRES_DST.

Header values are Batfish specifiers: srcIps/dstIps accept IPs, prefixes, node names, or named IP spaces; srcPorts/dstPorts take strings such as "443". If ipProtocols is omitted, Batfish tests ICMP, so set ipProtocols and dstPorts for service-level checks. Batfish returns representative flows for broad headers, so 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.

batfish_list_assertionsA

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_assertionA

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.

  • debug=True includes the raw Batfish error text on failures.

Returns {type, status (pass/fail/error), message, snapshot, ran_at, runtime, fun?, answer_rows?, details?, code?}. Failure messages are short: message is the one-line summary, and failing rows are returned as answer_rows when they can be parsed; otherwise details holds a capped records-style payload. Validation problems are returned as status: "error" with an errors list (nothing is run).

Header fields follow Batfish rules: srcIps/dstIps accept IPs, prefixes, and node names; srcPorts/dstPorts are string specs such as "443". When ipProtocols is omitted, Batfish tests ICMP, so set ipProtocols and dstPorts for service-level assertions. Prefer node names, interface locations, or explicit host IPs: broad prefixes may make Batfish choose representative flows with network-address sources.

batfish_run_assertion_suiteA

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 locations, or explicit host IPs over broad prefixes, which may make Batfish choose representative flows with network-address sources.

All-or-nothing: if the suite is invalid, nothing runs and the result is {results: [], errors: [...], summary: {...}}. Otherwise results are {type, status, message, snapshot, ran_at, runtime, fun?, answer_rows?, details?, code?} per assertion, plus a summary of pass/fail/error counts. Failure messages use a one-line summary; rows are returned as answer_rows when parseable, otherwise as capped details.

batfish_fork_snapshotA

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; use failed_nodes for those.

  • The failure-testing flow is: fork, then diff the fork against the base with a differential question.

  • network: the network both snapshots live in, if given.

Returns {name, base_name} — the name actually used.

batfish_get_topologyA

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}.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A3.9/5.0

Scored across 12 tools

Disambiguation4/5

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.

Naming Consistency5/5

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).

Tool Count5/5

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.

Completeness4/5

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.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues