Skip to main content
Glama
nxGnosis

Travel Agent MCP Server

by nxGnosis

GET_IMMIGRATION_INFO_BY_COUNTRY

Retrieve visa requirements and immigration details for international travel planning by specifying a country code.

Instructions

Get immigration information for a specific country.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countryCodeYes

Implementation Reference

  • The execute function implementing the core tool logic: fetches raw immigration data using the service, parses and formats it into a user-friendly string with emojis detailing services, descriptions, fees, requirements per country, and handles errors appropriately.
    execute: async (params: getImmigrationCountryParam) => {
    	try {
    		const immigrationInfo =
    			await immigrationService.getImmigrationInfoByCountry(
    				params.countryCode,
    			);
    
    		let formattedImmigrationInfo = `šŸ’¼ Immigration information for ${params.countryCode}:\n`;
    
    		if (
    			immigrationInfo && immigrationInfo.data && Array.isArray(immigrationInfo.data.data)
    		) {
    			if (immigrationInfo.data.data.length > 0) {
    				immigrationInfo.data.data.forEach((service:any) => {
    				  formattedImmigrationInfo += `\nšŸ›ļø Service: ${service.name || "N/A"}`;
    				  formattedImmigrationInfo += `\nšŸ“„ Description: ${service.description || "N/A"}`;
    				  formattedImmigrationInfo += `\nšŸ’¬ Consultation Note: ${service.consultation_note || "N/A"}`;
    				  
    				  if (Array.isArray(service.countries) && service.countries.length > 0) {
    					// Iterate through each country for this service
    					service.countries.forEach((country:any) => {
    					  formattedImmigrationInfo += `\nšŸŒ Country: ${country.country_code || "N/A"}`;
    					  formattedImmigrationInfo += `\nšŸ’° Consultation Fee: $${country.consultation_fee || "N/A"}`;
    					  formattedImmigrationInfo += `\nšŸ’° Service Fee: $${country.service_fee || "N/A"}`;
    					  
    					  if (Array.isArray(country.requirements) && country.requirements.length > 0) {
    						formattedImmigrationInfo += "\nāœ… Requirements:";
    						country.requirements.forEach((req:any) => {
    						  formattedImmigrationInfo += `\n  - ${req.requirement || "N/A"} (${req.response_type || "N/A"})`;
    						});
    					  } else {
    						formattedImmigrationInfo += "\nNo specific requirements listed for this country.";
    					  }
    					  formattedImmigrationInfo += "\n"; // Add spacing between countries
    					});
    				  } else {
    					formattedImmigrationInfo += "\nNo country-specific information available.";
    				  }
    				  formattedImmigrationInfo += "\n---\n"; // Add separator between services
    				});
    			  } else {
    				formattedImmigrationInfo += "No specific immigration information found for this country.";
    			  }
    		} else {
    			formattedImmigrationInfo +=
    				"Could not retrieve detailed immigration information.";
    		}
    
    		return dedent`${formattedImmigrationInfo}`;
    	} catch (error) {
    		// Rewriting error messages to be relevant to immigration information
    		if (error instanceof Error) {
    			return `Error fetching immigration information for ${params.countryCode}: ${error.message}`;
    		}
    		return `An unknown error occurred while fetching immigration information for ${params.countryCode}`;
    	}
    },
  • Zod schema defining the input parameters for the tool, specifically the required 'countryCode' string.
    const getImmigrationCountryParam = z.object({
    	countryCode: z
    		.string()
    		.describe("The ISO 3166-1 alpha-2 country code (e.g., 'US', 'GB')."),
    });
    
    type getImmigrationCountryParam = z.infer<typeof getImmigrationCountryParam>;
  • src/index.ts:17-18 (registration)
    Registers the GET_IMMIGRATION_INFO_BY_COUNTRY tool with the FastMCP server instance.
    //Add Immigration tools
    server.addTool(getImmigrationInfoByCountry);
  • Helper service method that performs the actual API call to retrieve raw immigration data for the specified country using fetch and the configured API endpoint and key.
    getImmigrationInfoByCountry: async (countryCode: string): Promise<any> => {
    	const url = `${config.immigrationApi.baseUrl}/immigration/service/country/${countryCode}?per_page=100`;
    	try {
    		const response = await fetch(url, {
    			headers: {
    				"x-api-key": config.immigrationApi.apiKey,
    			},
    		});
    		if (!response.ok) {
    			throw new Error(`HTTP error! status: ${response.status}`);
    		}
    		const data = await response.json();
    		return data;
    	} catch (error) {
    		console.error("Error fetching immigration info:", error);
    		throw error;
    	}
    },
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. It states 'Get' which implies a read-only operation, but does not disclose any behavioral traits such as rate limits, authentication needs, data freshness, or error handling. This is a significant gap for a tool with no 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, clear sentence with no wasted words. It is appropriately sized and front-loaded, efficiently conveying the core purpose without unnecessary elaboration.

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

Completeness2/5

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

Given the complexity of immigration information, lack of annotations, no output schema, and low schema coverage, the description is incomplete. It does not address what type of information is returned, potential limitations, or how it differs from the sibling tool, leaving the agent with insufficient context.

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

Parameters2/5

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

The schema description coverage is 0%, and the description does not add any meaning beyond the schema. It mentions 'specific country' but does not explain the 'countryCode' parameter's format, valid values, or semantics, failing to compensate for the low schema coverage.

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 verb 'Get' and the resource 'immigration information for a specific country', making the purpose understandable. However, it does not explicitly differentiate from its sibling tool GET_VISA_INFO_BY_COUNTRY, which likely provides overlapping or related information, so it misses the highest score.

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 its sibling GET_VISA_INFO_BY_COUNTRY, nor does it mention any prerequisites or alternative contexts. It lacks explicit usage instructions, leaving the agent to infer based on tool names alone.

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/nxGnosis/TravelAgentMCP'

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