list_countries
Retrieve a paginated list of countries with customizable detail levels, from basic info to comprehensive data, for geographic reference and analysis.
Instructions
List all countries with pagination. Returns basic info by default — add fields=full for all data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number (default: 1) | |
| limit | No | Results per page (default: 50, max: 100) | |
| fields | No | Detail level |
Implementation Reference
- src/tools/countries.ts:28-36 (handler)The handler function for the list_countries tool which constructs the API request with pagination and field parameters.
async ({ page, limit, fields }) => { const params = new URLSearchParams(); if (page) params.set('page', String(page)); if (limit) params.set('limit', String(limit)); if (fields) params.set('fields', fields); const qs = params.toString() ? `?${params}` : ''; const data = await apiGet(`/v1/api/geo/countries${qs}`); return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; } - src/tools/countries.ts:20-37 (registration)Registration of the list_countries tool within the McpServer instance.
server.tool( 'list_countries', 'List all countries with pagination. Returns basic info by default — add fields=full for all data.', { page: z.number().int().positive().optional().describe('Page number (default: 1)'), limit: z.number().int().min(1).max(100).optional().describe('Results per page (default: 50, max: 100)'), fields: z.enum(['basic', 'standard', 'full']).optional().describe('Detail level'), }, async ({ page, limit, fields }) => { const params = new URLSearchParams(); if (page) params.set('page', String(page)); if (limit) params.set('limit', String(limit)); if (fields) params.set('fields', fields); const qs = params.toString() ? `?${params}` : ''; const data = await apiGet(`/v1/api/geo/countries${qs}`); return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; } );