Skip to main content
Glama

get_departments_by_region

Retrieve departments for a specific Colombian region by providing its ID. Use this tool to find which departments belong to regions like Caribe, Pacífico, Orinoquía, Amazonía, Andina, or Insular.

Instructions

Obtiene todos los departamentos que pertenecen a una región específica.

Args:

  • region_id (number): ID de la región

    • 1 = Caribe

    • 2 = Pacífico

    • 3 = Orinoquía

    • 4 = Amazonía

    • 5 = Andina

    • 6 = Insular

Returns: Lista de departamentos de esa región.

Ejemplo de uso:

  • "¿Cuáles departamentos están en la región Caribe?"

  • "Dame los departamentos de la Amazonía"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
region_idYesID de la región (1=Caribe, 2=Pacífico, 3=Orinoquía, 4=Amazonía, 5=Andina, 6=Insular)

Implementation Reference

  • Handler function that takes region_id, fetches departments from `/Region/${region_id}/departments` API endpoint, maps region name, formats department list with id, name, capital, population, and returns as JSON text content.
    async ({ region_id }) => { try { const departments = await apiRequest<Department[]>(`/Region/${region_id}/departments`); const regionNames: Record<number, string> = { 1: "Caribe", 2: "Pacífico", 3: "Orinoquía", 4: "Amazonía", 5: "Andina", 6: "Insular", }; const resultado = { region: regionNames[region_id] || `Región ${region_id}`, total_departamentos: departments.length, departamentos: departments.map(d => ({ id: d.id, nombre: d.name, capital: d.cityCapital?.name || "N/A", poblacion: d.population, })), }; return { content: [ { type: "text", text: JSON.stringify(resultado, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error al obtener departamentos por región: ${error instanceof Error ? error.message : "Error desconocido"}`, }, ], }; } }
  • src/index.ts:281-355 (registration)
    Registration of the 'get_departments_by_region' tool using server.registerTool, including title, description, input schema for region_id, annotations, and the inline handler function.
    server.registerTool( "get_departments_by_region", { title: "Obtener Departamentos por Región", description: `Obtiene todos los departamentos que pertenecen a una región específica. Args: - region_id (number): ID de la región - 1 = Caribe - 2 = Pacífico - 3 = Orinoquía - 4 = Amazonía - 5 = Andina - 6 = Insular Returns: Lista de departamentos de esa región. Ejemplo de uso: - "¿Cuáles departamentos están en la región Caribe?" - "Dame los departamentos de la Amazonía"`, inputSchema: { region_id: z.number().int().min(1).max(6).describe("ID de la región (1=Caribe, 2=Pacífico, 3=Orinoquía, 4=Amazonía, 5=Andina, 6=Insular)"), }, annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true, }, }, async ({ region_id }) => { try { const departments = await apiRequest<Department[]>(`/Region/${region_id}/departments`); const regionNames: Record<number, string> = { 1: "Caribe", 2: "Pacífico", 3: "Orinoquía", 4: "Amazonía", 5: "Andina", 6: "Insular", }; const resultado = { region: regionNames[region_id] || `Región ${region_id}`, total_departamentos: departments.length, departamentos: departments.map(d => ({ id: d.id, nombre: d.name, capital: d.cityCapital?.name || "N/A", poblacion: d.population, })), }; return { content: [ { type: "text", text: JSON.stringify(resultado, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error al obtener departamentos por región: ${error instanceof Error ? error.message : "Error desconocido"}`, }, ], }; } } );
  • Zod input schema defining region_id as integer between 1 and 6 with description of region mappings.
    region_id: z.number().int().min(1).max(6).describe("ID de la región (1=Caribe, 2=Pacífico, 3=Orinoquía, 4=Amazonía, 5=Andina, 6=Insular)"), },

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