Skip to main content
Glama

create_challenge

Generate and save complete coding challenges with content, tests, and solutions for frontend development practice in JavaScript, TypeScript, HTML, or CSS.

Instructions

Create a complete coding challenge with all content generated by Claude and save it to FrontendLeap

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesThe challenge title (e.g., 'Advanced CSS Flexbox Centering Challenge')
descriptionYesBrief description of what the challenge teaches
explanationYesDetailed markdown explanation of the concept, including examples and learning objectives
starter_codeYesThe initial code template that users start with - should be relevant to the challenge
test_codeYesJavaScript test code (using Jasmine) that validates the user's solution
solutionNoOptional markdown explanation of the solution approach and key concepts
languageYesProgramming language for the challenge
difficultyYesChallenge difficulty level

Implementation Reference

  • The handler logic for 'create_challenge' tool call. It extracts arguments, makes an authenticated POST request to the FrontendLeap API to create the challenge, parses the response, and returns a rich text response with the new challenge's URL or an error message.
      if (name === "create_challenge") {
        try {
          if (!args) {
            throw new Error("Missing arguments for challenge creation");
          }
    
          const challengeData = args as {
            title: string;
            description: string;
            explanation: string;
            starter_code: string;
            test_code: string;
            solution?: string;
            language: string;
            difficulty: string;
          };
    
          console.error(`🚀 Creating challenge: ${challengeData.title} (${challengeData.difficulty}, ${challengeData.language})`);
    
          const response = await fetch(`${FRONTENDLEAP_API_URL}/api/mcp/challenges/create`, {
            method: 'POST',
            headers: {
              'Content-Type': 'application/json',
              'Authorization': `Bearer ${FRONTENDLEAP_API_KEY}`,
              'User-Agent': 'FrontendLeap-MCP-Server/0.1.0'
            },
            body: JSON.stringify(challengeData),
            // Bypass SSL verification for local development
            agent: FRONTENDLEAP_API_URL.includes('.test') || FRONTENDLEAP_API_URL.includes('localhost') ? httpsAgent : undefined
          });
    
          if (!response.ok) {
            const errorText = await response.text();
            throw new Error(`API request failed: ${response.status} ${response.statusText} - ${errorText}`);
          }
    
          const data = await response.json() as {
            success: boolean;
            error?: string;
            challenge_url: string;
            challenge: {
              id: number;
              title: string;
              slug: string;
              difficulty: string;
              language: string;
            };
          };
    
          if (!data.success) {
            throw new Error(data.error || 'Challenge generation failed');
          }
    
          console.error(`✅ Challenge created: ${data.challenge.title}`);
    
          return {
            content: [
              {
                type: "text",
                text: `🎯 **Challenge Created Successfully!**
    
    **${data.challenge.title}**
    - **Difficulty:** ${challengeData.difficulty}
    - **Language:** ${challengeData.language}
    
    🔗 **Access your challenge here:** ${data.challenge_url}
    
    Your custom coding challenge is ready! The challenge includes:
    - Claude-generated explanation and learning objectives
    - Contextually relevant starter code
    - Comprehensive test cases
    - Interactive Monaco code editor
    
    The challenge is now live and ready for users to solve!`
              }
            ]
          };
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
          console.error(`❌ Error creating challenge: ${errorMessage}`);
    
          return {
            content: [
              {
                type: "text",
                text: `❌ **Error creating challenge**
    
    ${errorMessage}
    
    Please try again or check if the FrontendLeap API is accessible.`
              }
            ],
            isError: true
          };
        }
      }
  • Defines the JSON input schema for the 'create_challenge' tool, including all properties, descriptions, enums for language and difficulty, and required fields.
    inputSchema: {
      type: "object",
      properties: {
        title: {
          type: "string",
          description: "The challenge title (e.g., 'Advanced CSS Flexbox Centering Challenge')"
        },
        description: {
          type: "string",
          description: "Brief description of what the challenge teaches"
        },
        explanation: {
          type: "string",
          description: "Detailed markdown explanation of the concept, including examples and learning objectives"
        },
        starter_code: {
          type: "string",
          description: "The initial code template that users start with - should be relevant to the challenge"
        },
        test_code: {
          type: "string",
          description: "JavaScript test code (using Jasmine) that validates the user's solution"
        },
        solution: {
          type: "string",
          description: "Optional markdown explanation of the solution approach and key concepts"
        },
        language: {
          type: "string",
          enum: ["javascript", "html", "css", "typescript"],
          description: "Programming language for the challenge"
        },
        difficulty: {
          type: "string",
          enum: ["beginner", "intermediate", "advanced"],
          description: "Challenge difficulty level"
        }
      },
      required: ["title", "description", "explanation", "starter_code", "test_code", "language", "difficulty"]
    }
  • src/index.ts:35-84 (registration)
    Registers the 'create_challenge' tool by defining it in the ListToolsRequestHandler response, including its name, description, and input schema.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: "create_challenge",
            description: "Create a complete coding challenge with all content generated by Claude and save it to FrontendLeap",
            inputSchema: {
              type: "object",
              properties: {
                title: {
                  type: "string",
                  description: "The challenge title (e.g., 'Advanced CSS Flexbox Centering Challenge')"
                },
                description: {
                  type: "string",
                  description: "Brief description of what the challenge teaches"
                },
                explanation: {
                  type: "string",
                  description: "Detailed markdown explanation of the concept, including examples and learning objectives"
                },
                starter_code: {
                  type: "string",
                  description: "The initial code template that users start with - should be relevant to the challenge"
                },
                test_code: {
                  type: "string",
                  description: "JavaScript test code (using Jasmine) that validates the user's solution"
                },
                solution: {
                  type: "string",
                  description: "Optional markdown explanation of the solution approach and key concepts"
                },
                language: {
                  type: "string",
                  enum: ["javascript", "html", "css", "typescript"],
                  description: "Programming language for the challenge"
                },
                difficulty: {
                  type: "string",
                  enum: ["beginner", "intermediate", "advanced"],
                  description: "Challenge difficulty level"
                }
              },
              required: ["title", "description", "explanation", "starter_code", "test_code", "language", "difficulty"]
            }
          }
        ]
      };
    });
Behavior2/5

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

No annotations are provided, so the description carries full burden. While 'Create' and 'save' imply a write operation, it doesn't disclose behavioral traits like required permissions, whether the operation is idempotent, error conditions, or what happens on success. For a creation tool with zero annotation coverage, this is a significant gap.

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 a single, efficient sentence that communicates the core purpose without unnecessary words. It's appropriately sized and front-loaded with the essential information.

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

Completeness3/5

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

For a creation tool with 8 parameters, 100% schema coverage, and no output schema, the description provides adequate context about what the tool does but lacks important behavioral information. Without annotations or output schema, users don't know what happens after creation or what permissions are required.

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%, providing detailed documentation for all 8 parameters. The description adds no parameter-specific information beyond what's in the schema, so it meets the baseline of 3 when schema does the heavy lifting.

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 action ('Create a complete coding challenge'), specifies the content source ('all content generated by Claude'), and identifies the destination system ('save it to FrontendLeap'). It uses specific verbs and resources without being tautological.

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 this should be used when creating coding challenges for FrontendLeap, but provides no explicit guidance on when to use this tool versus alternatives, prerequisites, or constraints. With no sibling tools mentioned, the baseline is adequate but unguided.

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/FromtendLeap/FrontendLeap-MCP-challenge'

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