get_daily_challenge
Retrieve today’s LeetCode Daily Challenge problem directly with complete details, including problem description, constraints, and examples for efficient coding practice.
Instructions
Retrieves today's LeetCode Daily Challenge problem with complete details, including problem description, constraints, and examples
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/tools/problem-tools.ts:19-31 (handler)The inline async handler function for the 'get_daily_challenge' MCP tool. It fetches today's LeetCode Daily Challenge using the injected leetcodeService and returns formatted JSON content including date and problem details.const data = await this.leetcodeService.fetchDailyChallenge(); return { content: [ { type: "text", text: JSON.stringify({ date: new Date().toISOString().split("T")[0], problem: data }) } ] }; }
- src/mcp/tools/problem-tools.ts:15-32 (registration)The server.tool() call that registers the 'get_daily_challenge' tool on the MCP server, specifying name, description, empty input schema, and the handler function."get_daily_challenge", "Retrieves today's LeetCode Daily Challenge problem with complete details, including problem description, constraints, and examples", {}, async () => { const data = await this.leetcodeService.fetchDailyChallenge(); return { content: [ { type: "text", text: JSON.stringify({ date: new Date().toISOString().split("T")[0], problem: data }) } ] }; } );
- src/mcp/tools/problem-tools.ts:144-150 (registration)The registerProblemTools function exported from problem-tools.ts, which instantiates ProblemToolRegistry and triggers registration of problem tools including get_daily_challenge.export function registerProblemTools( server: McpServer, leetcodeService: LeetCodeBaseService ): void { const registry = new ProblemToolRegistry(server, leetcodeService); registry.registerTools(); }
- src/index.ts:93-93 (registration)Main entry point registration in index.ts calling registerProblemTools with the MCP server and LeetCode service instance.registerProblemTools(server, leetcodeService);
- Example helper implementation of fetchDailyChallenge() in LeetCodeGlobalService (similar in CN service), wrapping the underlying API call.async fetchDailyChallenge(): Promise<any> { const dailyChallenge = await this.leetCodeApi.daily(); return dailyChallenge; }