get_committees
Retrieve a JSON array of all active parliamentary committees, including IDs, names, and URLs, via the OpenTK MCP server. Use this to explore committees by domain or initiate further analysis with 'get_committee_details'.
Instructions
Retrieves a list of all parliamentary committees with their IDs, names, and URLs. The response is a JSON array where each entry represents a committee with its unique identifier and name. Use this tool when a user asks about parliamentary committees, wants to know which committees exist, or needs to find committees related to specific policy areas. Committees are specialized groups of MPs that focus on specific domains like defense, healthcare, or finance. After getting the list of committees, you can use the 'get_committee_details' tool with a specific committee ID to retrieve more detailed information about that committee, including its members and recent activities. This tool takes no parameters as it returns all active committees.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:436-465 (handler)MCP tool registration and handler for 'get_committees'. Fetches HTML from /commissies.html via apiService, extracts committees using extractCommitteesFromHtml utility, and returns JSON array of committees or error message./** Get committees */ mcp.tool( "get_committees", "Retrieves a list of all parliamentary committees with their IDs, names, and URLs. The response is a JSON array where each entry represents a committee with its unique identifier and name. Committees are specialized groups of MPs that focus on specific domains like defense, healthcare, or finance. This tool takes no parameters as it returns all active committees.", {}, async () => { try { const html = await apiService.fetchHtml("/commissies.html"); const committees = extractCommitteesFromHtml(html, BASE_URL); if (committees.length === 0) { return { content: [{ type: "text", text: "No committees found or there was an error retrieving the committee list. Please try again later." }] }; } return { content: [{ type: "text", text: JSON.stringify(committees, null, 2) }] }; } catch (error: any) { return { content: [{ type: "text", text: `Error fetching committees: ${error.message || 'Unknown error'}` }] }; } } );
- src/utils/html-parser.ts:186-230 (helper)Helper function that parses the HTML table from the committees page (/commissies.html) to extract an array of Committee objects, each with id, name, and resolved url.export function extractCommitteesFromHtml(html: string, baseUrl: string): Committee[] { if (!html) { return []; } const committees: Committee[] = []; // Extract the table containing committees const tableRegex = /<table[^>]*>[\s\S]*?<tbody>([\s\S]*?)<\/tbody>/i; const tableMatch = html.match(tableRegex); if (!tableMatch || !tableMatch[1]) { return []; } const tableContent = tableMatch[1]; // Extract each row (committee) from the table const rowRegex = /<tr[^>]*>([\s\S]*?)<\/tr>/gi; let rowMatch; while ((rowMatch = rowRegex.exec(tableContent)) !== null) { if (!rowMatch[1]) continue; const rowContent = rowMatch[1]; // Extract the committee ID and name from the link const linkRegex = /<a href="(commissie\.html\?id=([^"]+))">([^<]+)<\/a>/i; const linkMatch = rowContent.match(linkRegex); if (linkMatch && linkMatch[1] && linkMatch[2] && linkMatch[3]) { const id = linkMatch[2]; const name = linkMatch[3].trim(); const url = new URL(linkMatch[1], baseUrl).href; committees.push({ id, name, url }); } } return committees; }
- src/utils/html-parser.ts:21-25 (schema)TypeScript interface defining the structure of a Committee object used as output type for get_committees tool.interface Committee { id: string; name: string; url: string; }