senadores
Retrieve detailed information about senators in Argentina using this tool, designed to provide access to legislative data from the Argentina Datos API. Ideal for researchers and analysts.
Instructions
Devuelve los senadores.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- main.ts:372-394 (handler)The handler function for the "senadores" tool. It calls getSenadores() to fetch the data, handles empty results and errors, and returns the data as JSON or appropriate text messages.server.tool("senadores", "Devuelve los senadores.", {}, async ({}) => { try { const data = await getSenadores(); if (data.length === 0) { return { content: [{ type: "text", text: "No se encontraron senadores" }], }; } return { content: [ { type: "text", text: JSON.stringify(data, null, 2), mimeType: "application/json", }, ], }; } catch (error) { return { content: [{ type: "text", text: "Error al obtener los senadores" }], }; } });
- utils/functions.ts:34-38 (helper)Helper function that fetches the list of senators from the Argentina Datos API.export const getSenadores = async () => { const senadores = await fetch(`${BASE_URL}/senado/senadores`); const data = await senadores.json(); return data; };
- main.ts:64-68 (schema)Tool schema definition in the McpServer constructor, specifying name, description, and empty parameters for the "senadores" tool.{ name: "senadores", description: "Devuelve los senadores.", parameters: {}, },
- main.ts:371-394 (registration)Registration of the "senadores" tool using server.tool, including the handler function.// senadores server.tool("senadores", "Devuelve los senadores.", {}, async ({}) => { try { const data = await getSenadores(); if (data.length === 0) { return { content: [{ type: "text", text: "No se encontraron senadores" }], }; } return { content: [ { type: "text", text: JSON.stringify(data, null, 2), mimeType: "application/json", }, ], }; } catch (error) { return { content: [{ type: "text", text: "Error al obtener los senadores" }], }; } });