ctftime_top_by_country
Retrieve top CTF teams of the current year for a given country code.
Instructions
Get top teams for the current year by country (ISO 3166-1 alpha-2 country code, lowercase).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| country_code | Yes | Country code (e.g., 'pl', 'us', 'de'). |
Implementation Reference
- src/index.ts:146-167 (registration)Registration and handler for the ctftime_top_by_country tool. Takes a 2-letter ISO 3166-1 alpha-2 country code and fetches top teams for that country from the CTFtime API endpoint /api/v1/top-by-country/{code}/.
server.registerTool( "ctftime_top_by_country", { description: "Get top teams for the current year by country (ISO 3166-1 alpha-2 country code, lowercase).", inputSchema: { country_code: z .string() .min(2) .max(2) .describe("Country code (e.g., 'pl', 'us', 'de')."), }, }, async ({ country_code }) => { const code = country_code.toLowerCase(); const url = `${CTFtime_API_BASE}/top-by-country/${code}/`; const data = await getJson<any[]>(url); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } ); - src/index.ts:151-157 (schema)Input schema for ctftime_top_by_country. Expects a single required string parameter 'country_code' with length exactly 2 (ISO 3166-1 alpha-2 format).
inputSchema: { country_code: z .string() .min(2) .max(2) .describe("Country code (e.g., 'pl', 'us', 'de')."), }, - src/index.ts:159-166 (handler)Handler function for ctftime_top_by_country. Normalizes the country code to lowercase, fetches top teams from the CTFtime API's top-by-country endpoint, and returns the JSON result as text content.
async ({ country_code }) => { const code = country_code.toLowerCase(); const url = `${CTFtime_API_BASE}/top-by-country/${code}/`; const data = await getJson<any[]>(url); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; }