Skip to main content
Glama

getRegionById

Retrieve detailed information about a specific Colombian region using its unique identifier. This tool provides comprehensive regional data including geographical and administrative details through the ApiColombiaMCP server.

Instructions

Get detailed information about a specific region by ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that implements the logic for the getRegionById tool. It fetches detailed information about a specific region from the Colombia API using the provided regionId, handles errors including 404, formats the response in a readable text format, and returns it as ApiColombiaResponse.
    export async function getRegionById(regionId: string): Promise<ApiColombiaResponse> {
        try {
            const apiUrl = process.env.API_COLOMBIA_URL || 'https://api-colombia.com/api/';
            const response = await fetch(`${apiUrl}v1/Region/${regionId}`);
            
            if (!response.ok) {
                if (response.status === 404) {
                    return {
                        content: [{
                            type: 'text',
                            text: `❌ No se encontró una región con el ID: ${regionId}`
                        }]
                    };
                }
                throw new Error(`HTTP error! status: ${response.status}`);
            }
            
            const regionData: RegionData = await response.json();
            
            // Format the region data into a readable text format
            const regionInfo = `
    🇨🇴 DETALLE DE LA REGIÓN
    ${'═'.repeat(80)}
    
    🌎 REGIÓN: ${regionData.name}
    📍 ID: ${regionData.id}
    📝 Descripción: ${regionData.description}
    ${regionData.departments ? `🏛️ Departamentos: ${regionData.departments.join(', ')}` : '🏛️ Departamentos: No especificados'}
    
    ${'═'.repeat(80)}
            `;
            
            return {
                content: [{
                    type: 'text',
                    text: regionInfo.trim()
                }]
            };
            
        } catch (error) {
            const errorMessage = error instanceof Error ? error.message : ERROR_MESSAGES.UNKNOWN_ERROR;
            return {
                content: [{
                    type: 'text',
                    text: `${ERROR_MESSAGES.FETCH_ERROR}: ${errorMessage}`
                }]
            };
        }
    }
  • Registration of the 'getRegionById' tool in the tools configuration array, linking the name, description from constants, and the handler function.
    {
      name: TOOL_NAMES.GET_REGION_BY_ID,
      description: TOOL_DESCRIPTIONS.GET_REGION_BY_ID,
      handler: getRegionById,
    },
  • Constants defining the tool name ('getRegionById') and description used in the tool schema and registration.
    export const TOOL_NAMES = {
      GET_COUNTRY: 'getCountry',
      GET_REGIONS: 'getRegions',
      GET_REGION_BY_ID: 'getRegionById',
      GET_DEPARTMENTS_BY_REGION: 'getDepartmentsByRegion',
    } as const;
    
    export const TOOL_DESCRIPTIONS = {
      GET_COUNTRY: 'Get information about a country',
      GET_REGIONS: 'Get list of regions in Colombia',
      GET_REGION_BY_ID: 'Get detailed information about a specific region by ID',
      GET_DEPARTMENTS_BY_REGION: 'Get list of departments for a specific region by region ID',
    } as const;
  • Type definition for the region data structure used in the getRegionById handler.
    interface RegionData {
        id: number;
        name: string;
        description: string;
        departments: string[] | null;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Get detailed information' implies a read-only operation, it doesn't specify aspects like authentication requirements, rate limits, error handling, or what 'detailed information' entails (e.g., fields returned). This is a significant gap for a tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Get detailed information about a specific region by ID') with zero waste. Every word earns its place, making it appropriately sized and well-structured for clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate but has clear gaps. It states what the tool does but lacks behavioral context (e.g., response format, error cases) and usage guidelines relative to siblings. For a tool with no structured data to rely on, this leaves the agent under-informed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't add parameter details beyond what the schema provides, as there are none to document. A baseline of 4 is applied since the description doesn't introduce unnecessary parameter information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('detailed information about a specific region by ID'), making it immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'getRegions' or 'getCountry', which might provide similar regional information through different mechanisms.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'getRegions' (which likely lists regions) or 'getDepartmentsByRegion' (which might retrieve related data). It lacks explicit when/when-not instructions or named alternatives, leaving usage context implied rather than stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/esneyder/apicolombia-mcp'

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