Skip to main content
Glama

get_presidents

Retrieve a list of Colombian presidents with their names, terms, political parties, and birth cities for historical reference and research purposes.

Instructions

Obtiene la lista de presidentes de Colombia.

Returns: Lista de presidentes con nombre, período, partido político y ciudad de nacimiento.

Ejemplo de uso:

  • "¿Quiénes han sido los presidentes de Colombia?"

  • "Lista de presidentes colombianos"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_presidents' tool. It fetches the list of presidents from the '/President' API endpoint using the shared apiRequest helper, maps the data to a structured format including name, period, party, etc., handles errors, and returns a text content response with JSON-stringified data.
    async () => { try { const presidents = await apiRequest<any[]>("/President"); const resultado = { total: presidents.length, presidentes: presidents.map(p => ({ id: p.id, nombre: p.name, apellido: p.lastName, inicio_periodo: p.startPeriodDate, fin_periodo: p.endPeriodDate, partido_politico: p.politicalParty, descripcion: p.description, imagen: p.image, ciudad_nacimiento_id: p.cityId, })), }; return { content: [ { type: "text", text: JSON.stringify(resultado, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error al obtener presidentes: ${error instanceof Error ? error.message : "Error desconocido"}`, }, ], }; } } );
  • The schema and metadata for the 'get_presidents' tool, defining its title, description, empty inputSchema (no input parameters required), and annotations indicating it's a read-only, non-destructive, idempotent, open-world tool.
    { title: "Obtener Presidentes de Colombia", description: `Obtiene la lista de presidentes de Colombia. Returns: Lista de presidentes con nombre, período, partido político y ciudad de nacimiento. Ejemplo de uso: - "¿Quiénes han sido los presidentes de Colombia?" - "Lista de presidentes colombianos"`, inputSchema: {}, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, },
  • src/index.ts:561-619 (registration)
    The registration of the 'get_presidents' tool via server.registerTool, including the tool name, schema/metadata, and inline handler function.
    server.registerTool( "get_presidents", { title: "Obtener Presidentes de Colombia", description: `Obtiene la lista de presidentes de Colombia. Returns: Lista de presidentes con nombre, período, partido político y ciudad de nacimiento. Ejemplo de uso: - "¿Quiénes han sido los presidentes de Colombia?" - "Lista de presidentes colombianos"`, inputSchema: {}, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, }, async () => { try { const presidents = await apiRequest<any[]>("/President"); const resultado = { total: presidents.length, presidentes: presidents.map(p => ({ id: p.id, nombre: p.name, apellido: p.lastName, inicio_periodo: p.startPeriodDate, fin_periodo: p.endPeriodDate, partido_politico: p.politicalParty, descripcion: p.description, imagen: p.image, ciudad_nacimiento_id: p.cityId, })), }; return { content: [ { type: "text", text: JSON.stringify(resultado, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error al obtener presidentes: ${error instanceof Error ? error.message : "Error desconocido"}`, }, ], }; } } );
  • Shared utility function 'apiRequest' used by the handler to make authenticated GET requests to the Colombia API endpoints, including error handling for non-OK responses.
    async function apiRequest<T>(endpoint: string): Promise<T> { const url = `${API_BASE_URL}${endpoint}`; const response = await fetch(url, { method: "GET", headers: { "Accept": "application/json", "Content-Type": "application/json", }, }); if (!response.ok) { throw new Error(`API Error: ${response.status} ${response.statusText}`); } return response.json() as Promise<T>; }

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/crexative/colombia-mcp-server'

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