diputados
Access legislative data on Argentine deputies through the Argentina Datos API. Retrieve information about national representatives to support research, analysis, and civic engagement.
Instructions
Devuelve los diputados.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.ts:473-495 (handler)Handler implementation for the 'diputados' tool: calls getDiputados(), handles empty data and errors, returns JSON response.
server.tool("diputados", "Devuelve los diputados.", {}, async ({}) => { try { const data = await getDiputados(); if (data.length === 0) { return { content: [{ type: "text", text: "No se encontraron diputados" }], }; } return { content: [ { type: "text", text: JSON.stringify(data, null, 2), mimeType: "application/json", }, ], }; } catch (error) { return { content: [{ type: "text", text: "Error al obtener los diputados" }], }; } }); - main.ts:81-85 (schema)Schema definition for the 'diputados' tool in the MCP server tools list, specifying name, description, and empty parameters.
{ name: "diputados", description: "Devuelve los diputados.", parameters: {}, }, - utils/functions.ts:52-56 (helper)Core helper function getDiputados that fetches the list of diputados from the Argentina Datos API.
export const getDiputados = async () => { const diputados = await fetch(`${BASE_URL}/diputados/diputados`); const data = await diputados.json(); return data; }; - main.ts:472-495 (registration)Registration of the 'diputados' tool handler on the MCP server.
// diputados server.tool("diputados", "Devuelve los diputados.", {}, async ({}) => { try { const data = await getDiputados(); if (data.length === 0) { return { content: [{ type: "text", text: "No se encontraron diputados" }], }; } return { content: [ { type: "text", text: JSON.stringify(data, null, 2), mimeType: "application/json", }, ], }; } catch (error) { return { content: [{ type: "text", text: "Error al obtener los diputados" }], }; } });