Skip to main content
Glama
nxGnosis

Travel Agent MCP Server

by nxGnosis

GET_VISA_INFO_BY_COUNTRY

Retrieve visa requirements and immigration details for specific countries to plan international travel with accurate, up-to-date information.

Instructions

Get visa information for a specific country.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countryCodeYes
currencyCodeNo

Implementation Reference

  • The execute function implementing the core logic of the GET_VISA_INFO_BY_COUNTRY tool. It calls the visaService to fetch data and formats a detailed response with country info, news, FAQ, visa types, etc.
    	execute: async (params: getVisaCountryParam) => {
    		try {
    			const visaInfoResponse = await visaService.getVisaInfoByCountry(
    				params.countryCode,
    				params.currencyCode,
    			);
    
    			let formattedOutput = `šŸ›‚ Visa information for ${params.countryCode}:\n`;
    
    			if (visaInfoResponse && visaInfoResponse.data) {
    				const { visaCountry, visaNews, visaFaq, visaTypes, bookingsCount } = visaInfoResponse.data;
    				
    				// Country Information
    				if (visaCountry) {
    				  formattedOutput += `\nšŸŒ Country: ${visaCountry.name} (${visaCountry.country_code})`;
    				  formattedOutput += `\nšŸ“ø Image: ${visaCountry.image || "N/A"}`;
    				  formattedOutput += `\nšŸ‘„ Banned Countries: ${visaCountry.banned?.join(", ") || "None"}`;
    				  formattedOutput += `\nāœˆļø No Visa Required For: ${visaCountry.no_visa?.join(", ") || "None"}`;
    				  formattedOutput += `\nāš ļø Status: ${visaCountry.status || "N/A"}`;
    				} else {
    				  formattedOutput += "\nNo country details found.";
    				}
    			  
    				// Visa News
    				if (visaNews && visaNews.length > 0) {
    				  formattedOutput += "\n\nšŸ“° Visa News:";
    				  visaNews.forEach((news:any) => {
    					formattedOutput += `\n  - ${news.title || "No title"}: ${news.content || "No content"}`;
    				  });
    				}
    			  
    				// Visa FAQ
    				if (visaFaq && visaFaq.length > 0) {
    				  formattedOutput += "\n\nšŸ“š Visa FAQ:";
    				  visaFaq.forEach((faq:any) => {
    					formattedOutput += `\n  - šŸ’¬ Question: ${faq.question || "No question"}`;
    					formattedOutput += `\n    šŸ’¬ Answer: ${faq.answer || "No answer"}`;
    				  });
    				}
    			  
    				// Visa Types
    				if (visaTypes && visaTypes.length > 0) {
    				  formattedOutput += "\n\nšŸŽŸļø Visa Types:";
    				  visaTypes.forEach((type:any) => {
    					formattedOutput += `\nVisa Type: ${type.name || "N/A"}`;
    					formattedOutput += `\nšŸŒ Country Code: ${type.country_code || "N/A"}`;
    					formattedOutput += `\n#ļøāƒ£ Base Code: ${type.base_code || "N/A"}`;
    					formattedOutput += `\nšŸ’° Total Price: $${type.total_price || "N/A"}`;
    					formattedOutput += `\nšŸ’° Processing Fee: $${type.processing_fee || "N/A"}`;
    					formattedOutput += `\nšŸ’° Government Fee: $${type.government_fee || "N/A"}`;
    					formattedOutput += `\nšŸ’¼ Entry Type: ${type.entry_type || "N/A"}`;
    					formattedOutput += `\nā° Validity Period: ${type.validity_period || "N/A"} days`;
    					formattedOutput += `\nāœ… Status: ${type.status || "N/A"}`;
    			  
    					if (type.keyRequirements && type.keyRequirements.length > 0) {
    					  formattedOutput += "\nšŸ“„ Key Requirements:";
    					  type.keyRequirements.forEach((req:any) => {
    						formattedOutput += `\n  - ${req.requirement || "N/A"}`;
    					  });
    					}
    			  
    					if (type.benefits && type.benefits.length > 0) {
    					  formattedOutput += "\n⭐ Benefits:";
    					  type.benefits.forEach((benefit:any) => {
    						formattedOutput += `\n  - ${benefit.benefit || "N/A"}`;
    					  });
    					}
    			  
    					if (type.additionalRequirements && type.additionalRequirements.length > 0) {
    					  formattedOutput += "\nāš ļø Additional Requirements:";
    					  type.additionalRequirements.forEach((additionalRequirement:any) => {
    						formattedOutput += `\n  - ${additionalRequirement.question || "N/A"}`;
    					  });
    					}
    			  
    					formattedOutput += "\n---\n"; // Add separator between visa types
    				  });
    				}
    			  
    				formattedOutput += `\nšŸ›’ Total Bookings: ${bookingsCount || 0}`;
    			  } else {
    				formattedOutput += "Could not retrieve visa information.";
    			  }
    
    			return dedent`${formattedOutput}`;
    		} catch (error) {
    			if (error instanceof Error) {
    				return `Error fetching visa information for ${params.countryCode}: ${error.message}`;
    			}
    			return `An unknown error occurred while fetching visa information for ${params.countryCode}`;
    		}
    	},
    };
  • Zod schema for tool parameters: required countryCode (ISO alpha-3) and optional currencyCode.
    const getVisaCountryParam = z.object({
    	countryCode: z
    		.string()
    		.describe("The ISO 3166-1 alpha-3 country code (e.g., 'USA', 'GHA')."),
    	currencyCode: z
    		.string()
    		.optional()
    		.describe(
    			"Optional currency code for the country, if applicable (e.g., 'USD', 'EUR').",
    		),
    });
  • src/index.ts:14-15 (registration)
    Registration of the GET_VISA_INFO_BY_COUNTRY tool with the FastMCP server.
    // Add Visa tools
    server.addTool(getVisaInfoByCountry);
  • Helper service that fetches visa data from the external API, transforms it, and returns structured data used by the tool handler.
    getVisaInfoByCountry: async (
    	countryCode: string,
    	currencyCode?: string,
    ): Promise<any> => {
    	let url = `${config.visaApi.baseUrl}/visa/country/details/${countryCode}`;
    	if (currencyCode) {
    		url += `?currencyCode=${currencyCode}`;
    	}
    	try {
    		const response = await fetch(url, {
    			headers: {
    				"x-api-key": config.visaApi.apiKey,
    			},
    		});
    		if (!response.ok) {
    			throw new Error(`HTTP error! status: ${response.status}`);
    		}
    		const rawData = await response.json();
    
    		// Transform the raw data into the expected structure
    		const formattedData = {
    			data: {
    				visaCountry: rawData.data?.visaCountry || null, // Assuming rawData.data.visaCountry contains the country details
    				visaNews: rawData.data?.visaNews || [],
    				visaFaq: rawData.data?.visaFaq || [],
    				visaTypes: rawData.data?.visaTypes || [],
    				bookingsCount: rawData.data?.bookingsCount || 0,
    			},
    		};
    		return formattedData;
    	} catch (error) {
    		console.error("Error fetching visa info:", error);
    		throw error;
    	}
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure but only states the basic action without details on permissions, rate limits, error handling, or response format. It doesn't add meaningful context beyond the minimal purpose, failing to compensate for the lack of structured annotations.

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, making it highly concise and front-loaded. It efficiently communicates the core purpose without unnecessary elaboration, earning full marks for brevity and structure.

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 tool's complexity (2 parameters, no output schema, and no annotations), the description is insufficient. It lacks details on parameter usage, behavioral traits, and output expectations, making it incomplete for effective agent operation despite the concise structure.

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 doesn't mention any parameters or their meanings. It fails to explain what 'countryCode' and 'currencyCode' represent, their expected formats, or how they influence the output, leaving both parameters undocumented and adding no value beyond the bare schema.

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 ('visa information for a specific country'), making it immediately understandable. However, it doesn't explicitly differentiate from its sibling tool 'GET_IMMIGRATION_INFO_BY_COUNTRY', which likely covers related but distinct information, preventing a perfect 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_IMMIGRATION_INFO_BY_COUNTRY', nor does it mention any prerequisites, alternatives, or exclusions. It only states what the tool does, leaving the agent to infer usage context without explicit direction.

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