hansard_stats
Answers questions whose answer is a number: how many speeches, how many words, over which days, grouped by speaker, portfolio, chamber, debate, month, parliament or kind. Returns aggregates only, never speech text. Use it instead of paging search_hansard.
| Fact | Value |
|---|---|
| Tool | hansard_stats |
| Partner scope required | hansard:read |
| Subscriber tier required | AI Pro |
Accepts as_at | no |
Parameters
| Name | Type | Required | Default |
|---|---|---|---|
group_by | array of string | yes | |
metrics | array of string | no | null |
query | string | no | null |
speakers | array of string | no | null |
portfolios | array of string | no | null |
chambers | array of string | no | null |
topics | array of string | no | null |
parliament_number | integer | no | null |
aao_register_id | string | no | null |
date_from | string | no | null |
date_to | string | no | null |
ministers_only | boolean | no | false |
order_by | string | no | null |
top_n | integer | no | null |
limit | integer | no | 50 |
offset | integer | no | 0 |
cursor | string | no | null |
Notes
group_bytakes one or two ofspeaker,portfolio,chamber,debate_title,month,parliament,kind.metrics(default["speech_count"]) takes any ofspeech_count,total_words,avg_words,distinct_sitting_days,max_words,first_date,last_date.speech_countis always included.- The filters are the same as
search_hansard's, with the same meaning. Compute a figure here, then pass the same filters tosearch_hansardto read the speeches behind it, and the numbers agree. top_nwith twogroup_bydimensions returns the top N inner groups for each outer group, for example each speaker's five most-debated topics.totalcounts groups, not speeches.limitis capped at 200; page withpage.next_cursororoffset.- Read
notesbefore quoting a number. A speech is one contribution: an interjection and a long second reading speech each count as one. Word counts include material incorporated by leave, which was not spoken.
Request (hansard_stats with {"group_by":["chamber"],"metrics":["speech_count","total_words"],"date_from":"2025-07-01","date_to":"2026-06-30"})
Python SDK
import asyncio, os
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
async def main():
headers = {"Authorization": f"Bearer {os.environ['LAWATLAS_API_KEY']}"}
async with streamablehttp_client("https://advisor.lawatlas.ai/api/mcp-http/mcp", headers=headers) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
result = await session.call_tool("hansard_stats", {
"group_by": [
"chamber"
],
"metrics": [
"speech_count",
"total_words"
],
"date_from": "2025-07-01",
"date_to": "2026-06-30"
})
print(result.content[0].text)
asyncio.run(main())
curl
curl -s https://advisor.lawatlas.ai/api/mcp-http/mcp \
-H "Authorization: Bearer $LAWATLAS_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"hansard_stats","arguments":{"group_by":["chamber"],"metrics":["speech_count","total_words"],"date_from":"2025-07-01","date_to":"2026-06-30"}}}'
Response, as Advisor returned it on 10 October 2026. The tool's result is the JSON text of result.content[0].text; lists and long text are trimmed where marked "...".
{
"schema_version": "3.5",
"result": [
{
"group": {
"chamber": "senate"
},
"speech_count": 18239,
"total_words": 3557477
},
{
"group": {
"chamber": "hofreps"
},
"speech_count": 17538,
"total_words": 6969248
}
],
"page": {
"returned": 2,
"total": 2,
"next_cursor": null,
"truncated": false,
"limit_requested": 50,
"limit_applied": 50
},
"group_by": [
"chamber"
],
"source": "Parliamentary Debates (Hansard), Parliament of Australia",
"disclosure": "Speaker portfolio is the portfolio held on the date of the speech, under the Administrative Arrangements Order in force that day. It indicates that the speaker was a minister in that portfolio.",
"corpus": {
"corpus_through": "2026-09-16",
"corpus_ingested_at": "2026-09-16T09:54:45+00:00"
},
"notes": [
"A 'speech' is one Hansard contribution. A one-line interjection and a 3,570-word second-reading speech each count as one - 29.6% of the corpus is interjections. speech_count is not a measure of how much someone spoke; use total_words for that, or group_by=['kind'] to separate them.",
"word_count includes material incorporated into Hansard by leave, which is not spoken. The corpus carries no flag distinguishing it, so word totals are an upper bound: one 6,551-word contribution in June 2026 is seven written government responses to committee reports."
],
"usage": "Aggregate counts only - no speech text. Pass the same filters to search_hansard to read the speeches behind any number. `total` counts groups, not speeches."
}
Note: Hansard passages come with conditions of use, and your service must keep them.
- Verbatim. Reproduce a passage unaltered. Analysis around a quotation is fine; rewriting the quotation is not.
- Attributed. Attribute each passage to "Parliamentary Debates (Hansard), Parliament of Australia" and show the reader the
official_recordlink.- Not fetched. Show the
official_recordlink, do not fetch it: aph.gov.au refuses automated requests.- Not the official record. Advisor is a search over the record, not the record. Label your service the same way.
- Not for satire, ridicule or political advertising, or to misrepresent any Senator or Member.
Errors
| Code | Meaning | What to do |
|---|---|---|
INVALID_ARGUMENT | A group_by, metrics or filter value is unknown | Use a value from the list in the message, or from list_hansard_filters |
TERMS_REQUIRED | A partner organisation has not accepted the Hansard conditions | Accept them on the partner page |