Skip to main content
What this gets you: any AI agent - Claude, Cursor, or one you built - gains the ability to look up real US law on its own, mid-conversation, with citations, instead of guessing from training data. Grounding an AI agent in authoritative legal text is one of the most common uses of this API. There are two ways to do it: connect an MCP-compatible client to the hosted Vaquill MCP server, or wrap the REST API as a tool your own agent can call. Both return citations and source links, so answers stay grounded in official government text. Endpoints used: POST /us/statutes/search for the custom-tool path. The hosted server path needs no direct REST calls from you.

Path A: Hosted Vaquill MCP server

The fastest route is the hosted Vaquill MCP server. Any MCP-compatible client can connect to it and query US statutes and regulations directly, without you writing glue code. The server exposes statute search and retrieval as tools the agent can call, and every result comes back with a citation and a link to the official source.

Vaquill MCP server

Connection details, available tools, and setup steps for the hosted MCP server.
Use this path when your agent runs inside an MCP-compatible client and you want statute access with the least integration work.

Path B: Wrap the REST API as your own tool

When you are building your own tool-calling agent, define a search_statutes function backed by POST /us/statutes/search and register it as a tool. The agent decides when to call it, and you return cited results the model can quote.
1

Implement the tool function

Ask the API for a narrow result with fields rather than fetching 40+ fields and throwing most of them away in Python. Every field you did not ask for is a field that never crossed the wire, never entered the tool result, and never entered the model’s context window. actId and citation always come back, because a row without them cannot be used or attributed.
Python
A result carries 40+ fields and most of them are null on any given row, so a page of 50 unfiltered results ships a lot of nulls. Trimming in Python fixes the context window but not the transfer; fields fixes both, and it is the one lever that scales with limit. See Text Formats and Source URLs for the canonical source-link preference order.
2

Declare the tool schema

Tool-calling agents need a schema so the model knows when and how to call your function. This shape (a name, a description, and a JSON Schema for parameters) is the common convention across tool-calling frameworks.
Python
3

Run the tool-call loop

When the model asks to call search_statutes, run the function with its arguments and hand the cited results back. The exact plumbing depends on your framework, but the flow is always the same: read the tool call, dispatch to the function, return the result, let the model compose a grounded answer.
Python
4

Keep answers grounded

Instruct the model to cite the citation field and link the sourceUrl for every legal claim, and to say when the corpus returns no match rather than guessing. This keeps the agent honest and traceable back to official text.
For heavy agent traffic, cache the /us/statutes/coverage response and reuse it to steer corpusType and state on tool calls. That narrows searches and avoids searching jurisdictions with no data.

Vaquill MCP server

Connect an MCP-compatible client to the hosted server.

Enrich a citation database

Batch-resolve topics into cited, sourced records.

Compare a rule across states

Run one query across several states.

Best practices

Scope queries, cache coverage, and handle errors well.
Last modified on September 6, 2026