get_indigenous_reservations
Retrieve and filter indigenous reservations in Colombia by department to access detailed information about their names, communities, and locations.
Instructions
Obtiene la lista de resguardos indígenas de Colombia. Puede filtrar por departamento.
Args:
department_id (number, opcional): ID del departamento para filtrar
Returns: Lista de resguardos indígenas con nombre, comunidad y departamento.
Ejemplo de uso:
"¿Cuáles son los resguardos indígenas de Colombia?"
"Resguardos indígenas en el Cauca"
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| department_id | No | ID del departamento para filtrar |
Implementation Reference
- src/index.ts:849-889 (handler)Handler function that fetches indigenous reservations (resguardos indígenas) from the Colombia API, optionally filtered by department_id. Limits to 50 results, formats and returns as JSON text content.async ({ department_id }) => { try { let reservations: any[]; if (department_id) { reservations = await apiRequest<any[]>(`/Department/${department_id}/indigenousreservations`); } else { reservations = await apiRequest<any[]>("/IndigenousReservation"); } const resultado = { total: reservations.length, resguardos: reservations.slice(0, 50).map(r => ({ id: r.id, nombre: r.name, codigo: r.code, comunidad_nativa: r.nativeCommunity, departamento_id: r.departmentId, ciudad_id: r.cityId, })), }; return { content: [ { type: "text", text: JSON.stringify(resultado, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error al obtener resguardos indígenas: ${error instanceof Error ? error.message : "Error desconocido"}`, }, ], }; } }
- src/index.ts:839-841 (schema)Input schema for the tool: optional department_id (integer) to filter reservations by department.inputSchema: { department_id: z.number().int().optional().describe("ID del departamento para filtrar"), },
- src/index.ts:824-890 (registration)Registration of the get_indigenous_reservations tool using server.registerTool, including title, description, input schema, annotations, and inline handler function.server.registerTool( "get_indigenous_reservations", { title: "Obtener Resguardos Indígenas", description: `Obtiene la lista de resguardos indígenas de Colombia. Puede filtrar por departamento. Args: - department_id (number, opcional): ID del departamento para filtrar Returns: Lista de resguardos indígenas con nombre, comunidad y departamento. Ejemplo de uso: - "¿Cuáles son los resguardos indígenas de Colombia?" - "Resguardos indígenas en el Cauca"`, inputSchema: { department_id: z.number().int().optional().describe("ID del departamento para filtrar"), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, }, async ({ department_id }) => { try { let reservations: any[]; if (department_id) { reservations = await apiRequest<any[]>(`/Department/${department_id}/indigenousreservations`); } else { reservations = await apiRequest<any[]>("/IndigenousReservation"); } const resultado = { total: reservations.length, resguardos: reservations.slice(0, 50).map(r => ({ id: r.id, nombre: r.name, codigo: r.code, comunidad_nativa: r.nativeCommunity, departamento_id: r.departmentId, ciudad_id: r.cityId, })), }; return { content: [ { type: "text", text: JSON.stringify(resultado, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error al obtener resguardos indígenas: ${error instanceof Error ? error.message : "Error desconocido"}`, }, ], }; } } );