Skip to main content
Glama
tomek7667

mcp-ctftime

by tomek7667

ctftime_events

Specify a time window with UNIX timestamps to list CTF events. Returns past and upcoming competitions from CTFtime.

Instructions

List CTFtime events in a time window. Uses UNIX timestamps (seconds) for start/finish; returns past and upcoming events.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax events (1-100).
startNoUNIX timestamp (seconds) for window start.
finishNoUNIX timestamp (seconds) for window finish.

Implementation Reference

  • src/index.ts:45-94 (registration)
    Registration of the 'ctftime_events' tool with server.registerTool(), including both the schema definition and the handler.
    server.registerTool(
    	"ctftime_events",
    	{
    		description:
    			"List CTFtime events in a time window. Uses UNIX timestamps (seconds) for start/finish; returns past and upcoming events.",
    		inputSchema: {
    			limit: z
    				.number()
    				.int()
    				.min(1)
    				.max(100)
    				.default(20)
    				.describe("Max events (1-100)."),
    			start: z
    				.number()
    				.int()
    				.optional()
    				.describe("UNIX timestamp (seconds) for window start."),
    			finish: z
    				.number()
    				.int()
    				.optional()
    				.describe("UNIX timestamp (seconds) for window finish."),
    		},
    	},
    	async ({ limit, start, finish }) => {
    		const url = `${CTFtime_API_BASE}/events/${qs({ limit, start, finish })}`;
    		const data = await getJson<any[]>(url);
    
    		// Lightly normalize for LLM consumption (keep original fields too).
    		const normalized = data.map((e) => ({
    			id: e.id,
    			title: e.title,
    			url: e.url,
    			start: e.start,
    			finish: e.finish,
    			format: e.format,
    			onsite: e.onsite,
    			weight: e.weight,
    			restrictions: e.restrictions,
    			ctftime_url: e.ctftime_url,
    			organizers: e.organizers,
    			location: e.location,
    		}));
    
    		return {
    			content: [{ type: "text", text: JSON.stringify(normalized, null, 2) }],
    		};
    	}
    );
  • Input schema for ctftime_events: limit (optional, default 20, 1-100), start (optional UNIX timestamp), finish (optional UNIX timestamp).
    {
    	description:
    		"List CTFtime events in a time window. Uses UNIX timestamps (seconds) for start/finish; returns past and upcoming events.",
    	inputSchema: {
    		limit: z
    			.number()
    			.int()
    			.min(1)
    			.max(100)
    			.default(20)
    			.describe("Max events (1-100)."),
    		start: z
    			.number()
    			.int()
    			.optional()
    			.describe("UNIX timestamp (seconds) for window start."),
    		finish: z
    			.number()
    			.int()
    			.optional()
    			.describe("UNIX timestamp (seconds) for window finish."),
    	},
  • Handler function: fetches events from CTFtime API, normalizes response data, returns JSON text content.
    async ({ limit, start, finish }) => {
    	const url = `${CTFtime_API_BASE}/events/${qs({ limit, start, finish })}`;
    	const data = await getJson<any[]>(url);
    
    	// Lightly normalize for LLM consumption (keep original fields too).
    	const normalized = data.map((e) => ({
    		id: e.id,
    		title: e.title,
    		url: e.url,
    		start: e.start,
    		finish: e.finish,
    		format: e.format,
    		onsite: e.onsite,
    		weight: e.weight,
    		restrictions: e.restrictions,
    		ctftime_url: e.ctftime_url,
    		organizers: e.organizers,
    		location: e.location,
    	}));
    
    	return {
    		content: [{ type: "text", text: JSON.stringify(normalized, null, 2) }],
    	};
    }
  • getJson helper: generic fetch wrapper with JSON parsing, error handling, and User-Agent header.
    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;
    }
  • qs helper: builds URL query string from params object, skipping undefined values.
    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?

With no annotations provided, the description carries the full burden. It discloses the use of UNIX timestamps and that both past and upcoming events are returned. However, it does not mention ordering, pagination, or any potential limits beyond the parameter schema. This leaves gaps in understanding the tool's behavior.

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 extremely concise: two sentences that clearly state the purpose, input format, and output scope. No unnecessary words or redundancy.

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

Completeness4/5

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

Given the simple parameter set (3 optional integers) and no output schema, the description combined with the schema covers most needs. It could be improved by noting ordering or pagination behavior, but overall it is sufficient for an agent to select and invoke the tool correctly.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The description adds that the tool returns past and upcoming events, which is not in the schema. However, the timestamp format is already described in the schema, so the added value is marginal.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists CTFtime events within a specified time window using UNIX timestamps. The verb 'list' and resource 'CTFtime events' are specific, and it distinguishes from siblings like ctftime_event (singular) and others that handle results or teams.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for listing events in a time window but does not explicitly state when to use or avoid this tool compared to alternatives like ctftime_event for single events. No exclusions or prerequisites are mentioned.

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