POST /us/statutes/search for the custom-tool path. The hosted server needs no REST calls from you.
Wrap the REST API as your own tool
Define asearch_statutes function backed by POST /us/statutes/search and register it as a tool.
The agent decides when to call it.
1
Implement the tool function
Use
fields to request only what the model needs. Fields you skip are never sent, and the saving grows with limit.
actId and citation always come back.Python
best_source_url() uses the order in Text formats and source URLs.2
Declare the tool schema
Give the model a schema (a name, a description, and a JSON Schema for parameters) so it knows when and how to call the function.
Python
3
Dispatch the call and keep answers grounded
When the model calls Tell the model to cite
search_statutes, run the function and return the cited results. The wiring depends on your framework.Python
citation and link sourceUrl for every legal claim, and to say so when nothing matches.
See Ground an LLM answer (RAG) for the prompt.Related
- Ground an LLM answer (RAG): the prompt pattern for cited answers.
- Corpus types: every valid
corpusTypevalue. - Best practices: scope queries, cache coverage and handle errors well.

