Skip to main content
Glama
tomek7667

mcp-ctftime

by tomek7667

ctftime_top_teams

Retrieve top CTF teams ranked for a specified year, or the current year if no year is given.

Instructions

Get top teams for a year (or current year if year omitted).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
yearNoYear (e.g., 2025).
limitNoMax teams (1-100).

Implementation Reference

  • src/index.ts:113-144 (registration)
    Registration of the 'ctftime_top_teams' tool using server.registerTool(). This is where the tool is registered with the MCP server, including its name, description, input schema (year and limit), and the handler callback.
    server.registerTool(
    	"ctftime_top_teams",
    	{
    		description: "Get top teams for a year (or current year if year omitted).",
    		inputSchema: {
    			year: z
    				.number()
    				.int()
    				.min(2011)
    				.max(2100)
    				.optional()
    				.describe("Year (e.g., 2025)."),
    			limit: z
    				.number()
    				.int()
    				.min(1)
    				.max(100)
    				.default(10)
    				.describe("Max teams (1-100)."),
    		},
    	},
    	async ({ year, limit }) => {
    		const base = year
    			? `${CTFtime_API_BASE}/top/${year}/`
    			: `${CTFtime_API_BASE}/top/`;
    		const url = `${base}${qs({ limit })}`;
    		const data = await getJson<any[]>(url);
    		return {
    			content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
    		};
    	}
    );
  • Handler function for ctftime_top_teams. Constructs the CTFtime API URL (with optional year and limit query params), fetches data via getJson helper, and returns the result as JSON text content.
    async ({ year, limit }) => {
    	const base = year
    		? `${CTFtime_API_BASE}/top/${year}/`
    		: `${CTFtime_API_BASE}/top/`;
    	const url = `${base}${qs({ limit })}`;
    	const data = await getJson<any[]>(url);
    	return {
    		content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
    	};
    }
  • Input schema for ctftime_top_teams using Zod validation. Defines optional 'year' (int, 2011-2100) and optional 'limit' (int, 1-100, default 10).
    {
    	description: "Get top teams for a year (or current year if year omitted).",
    	inputSchema: {
    		year: z
    			.number()
    			.int()
    			.min(2011)
    			.max(2100)
    			.optional()
    			.describe("Year (e.g., 2025)."),
    		limit: z
    			.number()
    			.int()
    			.min(1)
    			.max(100)
    			.default(10)
    			.describe("Max teams (1-100)."),
    	},
  • Generic helper function getJson<T> used by the handler to fetch JSON from the CTFtime API. Also used by all other tools.
    async function getJson<T>(url: string): Promise<T> {
    	const res = await fetch(url, {
    		headers: {
    			Accept: "application/json",
    			// CTFtime doesn't require a UA header for this API, but it helps with debugging and etiquette.
    			"User-Agent": "mcp-ctftime/0.1.0 (+https://ctftime.org/api/)",
    		},
    	});
    	if (!res.ok) {
    		const text = await res.text().catch(() => "");
    		throw new Error(
    			`CTFtime API error ${res.status} for ${url}${
    				text ? `: ${text.slice(0, 300)}` : ""
    			}`
    		);
    	}
    	return (await res.json()) as T;
    }
  • Helper function qs (query string builder) used to construct URL query parameters, used by the ctftime_top_teams handler to append the limit parameter.
    function qs(params: Record<string, string | number | undefined>): string {
    	const u = new URLSearchParams();
    	for (const [k, v] of Object.entries(params)) {
    		if (v === undefined) continue;
    		u.set(k, String(v));
    	}
    	const s = u.toString();
    	return s ? `?${s}` : "";
    }
Behavior3/5

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

No annotations provided, so description must carry burden. It correctly implies a read operation ('get') and mentions the default year behavior. However, it does not disclose ordering criteria, data freshness, or any rate limits, leaving gaps.

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?

Single sentence with verb and object upfront, no redundant words. Every part serves a purpose.

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 no output schema and siblings, the description lacks crucial details: how top teams are ranked (e.g., points?), what output fields are returned, and that limit defaults to 10 (mentioned only in schema). It is too minimal for full context.

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?

Schema coverage is 100%, with clear parameter descriptions. Description adds value by clarifying that year defaults to current year when omitted, which is not in schema. This enhances agent understanding.

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?

Description clearly states the action 'Get top teams' and the condition 'for a year (or current year if omitted)'. It is specific and distinguishes from siblings like 'ctftime_top_by_country' by omission, but does not explicitly differentiate.

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?

Description only states when to use (for a year) but provides no guidance on when not to use, prerequisites, or alternatives like 'ctftime_top_by_country' or 'ctftime_results'.

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/tomek7667/mcp-ctftime'

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