Skip to main content
Glama
AshwinSundar

Congress[.]gov MCP Server

by AshwinSundar

get_bills

Retrieve U.S. congressional bills by congress, type, number, or date range to access legislative information directly from Congress.gov.

Instructions

Retrieve a list of bills. Full documentation for this endpoint -> https://github.com/LibraryOfCongress/api.congress.gov/blob/main/Documentation/BillEndpoint.md

Args: congress: Congress number (e.g., 118 for 118th Congress) bill_type: Type of bill - hr: House of Representatives Bill - s: Senate Bill - hjres: House Joint Resolution - sjres: Senate Joint Resolution - hconres: House Concurrent Resolution - sconres: Senate Concurrent Resolution - hres: House Simple Resolution - sres: Senate Simple Resolution bill_number: Specific bill number (requires congress and bill_type) offset: Starting record (default 0) limit: Maximum records to return (max 250, default 20) from_datetime: Start timestamp (YYYY-MM-DDTHH:MM:SSZ format) to_datetime: End timestamp (YYYY-MM-DDTHH:MM:SSZ format) sort: Sort order ('updateDate+asc' or 'updateDate+desc')

Returns: dict: Bill data from Congress.gov API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
congressNo
bill_typeNo
bill_numberNo
offsetNo
limitNo
from_datetimeNo
to_datetimeNo
sortNoupdateDate+desc

Implementation Reference

  • server.py:28-97 (handler)
    The primary handler for the 'get_bills' tool. Decorated with @mcp.tool() for registration in FastMCP. Implements logic to query Congress.gov API for bills using provided parameters, handles URL construction, request parameters, and error handling.
    @mcp.tool()
    async def get_bills(
        congress: int | None = None,
        bill_type: str | None = None,
        bill_number: int | None = None,
        offset: int = 0,
        limit: int = 20,
        from_datetime: str | None = None,
        to_datetime: str | None = None,
        sort: str = "updateDate+desc"
    ) -> dict:
        """
        Retrieve a list of bills. Full documentation for this endpoint -> https://github.com/LibraryOfCongress/api.congress.gov/blob/main/Documentation/BillEndpoint.md
    
        Args:
            congress: Congress number (e.g., 118 for 118th Congress)
            bill_type: Type of bill
                - hr: House of Representatives Bill
                - s: Senate Bill
                - hjres: House Joint Resolution
                - sjres: Senate Joint Resolution
                - hconres: House Concurrent Resolution
                - sconres: Senate Concurrent Resolution
                - hres: House Simple Resolution
                - sres: Senate Simple Resolution
            bill_number: Specific bill number (requires congress and bill_type)
            offset: Starting record (default 0)
            limit: Maximum records to return (max 250, default 20)
            from_datetime: Start timestamp (YYYY-MM-DDTHH:MM:SSZ format)
            to_datetime: End timestamp (YYYY-MM-DDTHH:MM:SSZ format)
            sort: Sort order ('updateDate+asc' or 'updateDate+desc')
    
        Returns:
            dict: Bill data from Congress.gov API
        """
        base_url = "https://api.congress.gov/v3/bill"
    
        url = base_url
        if congress:
            url += f"/{congress}"
            if bill_type:
                url += f"/{bill_type}"
                if bill_number:
                    url += f"/{bill_number}"
    
        params = {
            "api_key": congress_gov_api_key,
            "format": "json",
            "offset": offset,
            "limit": min(limit, 100)  # Enforce API max limit
        }
    
        if from_datetime:
            params["fromDateTime"] = from_datetime
        if to_datetime:
            params["toDateTime"] = to_datetime
        if not bill_number:
            params["sort"] = sort
    
        try:
            response = requests.get(url, params=params)
            response.raise_for_status()
            return response.json()
    
        except requests.exceptions.RequestException as e:
            return {
                "error": f"Failed to retrieve bills: {str(e)}",
                "status_code": getattr(e.response, "status_code", None)
            }
  • server.py:28-28 (registration)
    The @mcp.tool() decorator registers the get_bills function as an MCP tool.
    @mcp.tool()
  • Function signature with type annotations and comprehensive docstring defining input parameters and output for the get_bills tool schema.
    async def get_bills(
        congress: int | None = None,
        bill_type: str | None = None,
        bill_number: int | None = None,
        offset: int = 0,
        limit: int = 20,
        from_datetime: str | None = None,
        to_datetime: str | None = None,
        sort: str = "updateDate+desc"
    ) -> dict:
        """
        Retrieve a list of bills. Full documentation for this endpoint -> https://github.com/LibraryOfCongress/api.congress.gov/blob/main/Documentation/BillEndpoint.md
    
        Args:
            congress: Congress number (e.g., 118 for 118th Congress)
            bill_type: Type of bill
                - hr: House of Representatives Bill
                - s: Senate Bill
                - hjres: House Joint Resolution
                - sjres: Senate Joint Resolution
                - hconres: House Concurrent Resolution
                - sconres: Senate Concurrent Resolution
                - hres: House Simple Resolution
                - sres: Senate Simple Resolution
            bill_number: Specific bill number (requires congress and bill_type)
            offset: Starting record (default 0)
            limit: Maximum records to return (max 250, default 20)
            from_datetime: Start timestamp (YYYY-MM-DDTHH:MM:SSZ format)
            to_datetime: End timestamp (YYYY-MM-DDTHH:MM:SSZ format)
            sort: Sort order ('updateDate+asc' or 'updateDate+desc')
    
        Returns:
            dict: Bill data from Congress.gov API
        """
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool retrieves data and links to external docs, but fails to describe key traits like rate limits, authentication needs, error handling, or pagination behavior beyond basic parameter defaults. This is inadequate for a tool with 8 parameters and no structured safety hints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement, organized parameter list, and return note, but includes a redundant external documentation link that could be trimmed. Most sentences earn their place by providing essential information, though slight verbosity in the link reduces efficiency.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (8 parameters, no annotations, no output schema), the description covers parameters thoroughly but lacks behavioral context and output details. It is minimally viable for basic use but incomplete for full agent understanding, as it omits guidance on errors, data structure, or integration with siblings.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates fully by detailing all 8 parameters, including examples (e.g., congress number 118), enumerated options for bill_type, defaults, formats (e.g., YYYY-MM-DDTHH:MM:SSZ), and constraints (e.g., limit max 250). This adds significant meaning beyond the bare schema, making parameter usage clear.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description starts with 'Retrieve a list of bills,' which clearly states the verb ('retrieve') and resource ('bills'), making the purpose explicit. However, it does not differentiate this tool from its siblings (e.g., get_amendments, get_committees), which also retrieve legislative data, so it lacks sibling distinction, preventing a score of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, such as other sibling tools like get_amendments or get_members. It mentions a link to external documentation but does not offer explicit usage context, prerequisites, or exclusions, leaving the agent with minimal direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AshwinSundar/congress_gov_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server