Skip to main content
Glama
kupad95

UK Parliament MCP Server

by kupad95

find_entities

Search UK Parliament data to find MPs by name, party, constituency, or status; bills by title or stage; petitions by keyword; or fetch an MP's declared financial interests using name, member ID, or topic keyword.

Instructions

Find MPs, bills, petitions, or declared financial interests. entity_type='mp': search members by name/party/constituency/house/status. entity_type='bill': search legislation by title keyword/stage/house. entity_type='petition': find petitions by keyword. entity_type='interest': fetch an MP's declared financial interests. Pass name='John McDonnell' OR mp_id=178 (member ID from a prior MP lookup). Optionally add keyword to filter by topic (e.g. keyword='property'). To find ALL MPs with a given interest topic, omit name/mp_id and pass only keyword='defence'.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
entity_typeYesWhat to search for.
nameNoMP or Lord name. For entity_type='mp': filter by name. For entity_type='interest': fetch this specific MP's declared interests.
mp_idNoMP member ID (integer). For entity_type='interest': fetch declared interests for the MP with this ID. Use this when you already have the member ID from a prior find_entities mp lookup.
partyNoFilter MPs by party.
constituencyNoFilter MPs by constituency.
houseNoFilter by house.
statusNoFilter MPs by active or inactive status.
stageNoBill stage filter.
keywordNoBill title search, petition text search, or financial interest topic filter.
petition_stateNoPetition state filter. Default 'all'.
limitNoMaximum results. Default 20.

Implementation Reference

  • Main handler for the find_entities tool. Dispatches to findMPs, findBills, findPetitions, or findInterests based on entity_type argument.
    export async function handleFindTool(
      name: string,
      args: Record<string, unknown>
    ): Promise<string> {
      try {
        if (name !== "find_entities") {
          throw new Error(`Unknown tool: ${name}`);
        }
    
        const entityType = args.entity_type as string;
        const limit = (args.limit as number) ?? 20;
    
        if (entityType === "mp") {
          return await findMPs(args, limit);
        } else if (entityType === "bill") {
          return await findBills(args, limit);
        } else if (entityType === "petition") {
          return await findPetitions(args, limit);
        } else if (entityType === "interest") {
          return await findInterests(args, limit);
        } else {
          throw new Error(
            `Unknown entity_type: ${entityType}. Use 'mp', 'bill', 'petition', or 'interest'.`
          );
        }
      } catch (error) {
        const message =
          error instanceof Error ? error.message : "An unknown error occurred.";
        throw new Error(message);
      }
    }
  • Tool definition including inputSchema with entity_type enum (mp, bill, petition, interest) and various filter parameters like name, mp_id, party, constituency, keyword, etc.
    export const findTools = [
      {
        name: "find_entities",
        description:
          "Find MPs, bills, petitions, or declared financial interests. " +
          "entity_type='mp': search members by name/party/constituency/house/status. " +
          "entity_type='bill': search legislation by title keyword/stage/house. " +
          "entity_type='petition': find petitions by keyword. " +
          "entity_type='interest': fetch an MP's declared financial interests. Pass name='John McDonnell' OR mp_id=178 (member ID from a prior MP lookup). Optionally add keyword to filter by topic (e.g. keyword='property'). To find ALL MPs with a given interest topic, omit name/mp_id and pass only keyword='defence'.",
        inputSchema: {
          type: "object",
          properties: {
            entity_type: {
              type: "string",
              enum: ["mp", "bill", "petition", "interest"],
              description: "What to search for.",
            },
            name: {
              type: "string",
              description: "MP or Lord name. For entity_type='mp': filter by name. For entity_type='interest': fetch this specific MP's declared interests.",
            },
            mp_id: {
              type: "number",
              description: "MP member ID (integer). For entity_type='interest': fetch declared interests for the MP with this ID. Use this when you already have the member ID from a prior find_entities mp lookup.",
            },
            party: {
              type: "string",
              description: "Filter MPs by party.",
            },
            constituency: {
              type: "string",
              description: "Filter MPs by constituency.",
            },
            house: {
              type: "string",
              enum: ["Commons", "Lords"],
              description: "Filter by house.",
            },
            status: {
              type: "string",
              enum: ["active", "inactive"],
              description: "Filter MPs by active or inactive status.",
            },
            stage: {
              type: "string",
              description: "Bill stage filter.",
            },
            keyword: {
              type: "string",
              description:
                "Bill title search, petition text search, or financial interest topic filter.",
            },
            petition_state: {
              type: "string",
              enum: ["open", "closed", "all"],
              description: "Petition state filter. Default 'all'.",
            },
            limit: {
              type: "number",
              description: "Maximum results. Default 20.",
            },
          },
          required: ["entity_type"],
        },
      },
    ];
  • src/index.ts:12-12 (registration)
    Import of findTools and handleFindTool from src/tools/find.ts
    import { findTools, handleFindTool } from "./tools/find.js";
  • src/index.ts:38-38 (registration)
    Route for find_entities in the CallToolRequestSchema handler — calls handleFindTool when name is 'find_entities'
    else if (name === "find_entities") result = await handleFindTool(name, safeArgs);
  • src/index.ts:20-26 (registration)
    Registration of findTools in the allTools array passed to ListToolsRequestSchema handler
    const allTools = [
      ...rankTools,
      ...eventsTools,
      ...patternsTools,
      ...findTools,
      ...queryTools,
    ];
Behavior4/5

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

With no annotations provided, the description carries full burden. It clearly describes the search/fetch behavior, including filtering and parameter combinations. However, it does not mention pagination behavior, rate limits, or authentication requirements, which could be relevant for agent planning.

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 dense and informative, front-loading the main purpose. However, the structure is a single prose paragraph; a more structured format (e.g., bullet points or separate sections) could improve scanability. Nevertheless, every sentence adds value.

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

Completeness5/5

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

For a tool with 11 parameters, 4 entity types, and no output schema, the description is remarkably complete. It covers all entity_type behaviors, parameter combinations, and special use cases (e.g., interest topic queries). The agent can confidently select and invoke the tool without needing external documentation.

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?

Despite 100% schema coverage, the description adds significant value beyond the schema. It explains how entity_type changes the semantics of other parameters, provides concrete examples (e.g., name='John McDonnell', mp_id=178, keyword='property'), and details special usage patterns (e.g., finding all MPs with a topic). This goes well beyond the schema descriptions.

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

Purpose5/5

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

The description starts with a clear verb+resource statement: 'Find MPs, bills, petitions, or declared financial interests.' It then provides specific breakdown per entity_type, distinguishing each use case. The tool's purpose is explicit and distinct from sibling tools like analyze_patterns or query_entities.

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

Usage Guidelines5/5

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

The description offers extensive guidance: when to use name vs mp_id, how to combine parameters per entity_type, and special cases like fetching all MPs with an interest topic by omitting name/mp_id. It effectively tells the agent when and how to invoke the tool.

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/kupad95/uk-parliament-mcp-server'

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