feat: add Bills API tools (search_bills, get_bill_stages)#40
Open
MarkDunne wants to merge 2 commits into
Open
Conversation
Add two new MCP tools wrapping the UK Parliament Bills API: - search_bills: Search bills by title, house, and status. Returns bill title, current stage with sitting dates, sponsors, and a link to bills.parliament.uk. - get_bill_stages: Get the full legislative history of a bill with all stages and dates in order. Responses are shaped to give the LLM enough context (title, stage, dates, sponsors) without the noise (internal IDs, session metadata, photo URLs). Follows the same patterns as existing member/committee tools. Motivated by a production incident where the model answered a bill scheduling question from training data instead of live data, giving a date that was months out of date. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…pers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
search_billstool — search bills by title, house, and status; returns current stage with sitting dates and sponsorsget_bill_stagestool — get the full legislative history of a bill (all readings, committee stages, royal assent) with datesrequest_bills_apiutility inutils.pyfollowing the existingrequest_members_apipatternMotivation
A production user asked "when is the second reading for Preet Gill's Private Member's Bill?" and the model answered from training data (March 2025) instead of the correct date (17 April 2026). No bill-tracking tools existed, so the model had no way to look up live bill status.
Response shaping
Responses are carefully trimmed to balance LLM context:
Kept:
billId,title, URL, current house, stage description, sitting dates, sponsor name/party/constituency,isAct/isDefeatedstatusStripped: Internal IDs (
stageId,sessionId,billStageId),lastUpdate,billTypeId, session IDs, member photos/page URLs,sortOrder, promoters/agent/petitioning fieldsExample output
Test plan
search_billsandget_bill_stagesreturn correct data for known billsruff check)🤖 Generated with Claude Code