Skip to main content
Glama
crazyrabbitLTC

Vibe-Coder MCP Server

provide_clarification

Clarify coding feature requirements by submitting questions and answers to guide structured development workflows.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
featureIdYes
questionYes
answerYes

Implementation Reference

  • The main handler function for the 'provide_clarification' tool. It validates input using the schema, retrieves the feature, appends the clarification response, saves it, determines the next question, and returns appropriate response.
    const provideClarificationHandler: ToolHandler<z.infer<typeof ProvideClarificationSchema>> = async (params) => {
      try {
        const { featureId, question, answer } = ProvideClarificationSchema.parse(params);
        
        console.log(`\n[CLARIFICATION] Received request for feature ${featureId}\n  Question: "${question.substring(0, 50)}..."\n  Answer: "${answer.substring(0, 50)}..."`);
        
        // Get the feature
        const feature = getFeature(featureId);
        if (!feature) {
          console.log(`[CLARIFICATION] Feature ID ${featureId} not found`);
          return featureNotFoundError(featureId);
        }
        
        console.log(`[CLARIFICATION] Found feature: ${feature.name} with ${feature.clarificationResponses.length} existing responses`);
        
        // Add the clarification response to the feature
        feature.clarificationResponses.push({
          question,
          answer,
          timestamp: new Date()
        });
        
        console.log(`[CLARIFICATION] Added response, now has ${feature.clarificationResponses.length} responses`);
        
        // Save the feature with the updated clarification response
        updateFeature(featureId, feature);
        
        // Get the next question or indicate all questions are answered
        const nextQuestion = getNextClarificationQuestion(feature);
        
        if (nextQuestion) {
          // Check if nextQuestion is a string before using substring
          const questionPreview = typeof nextQuestion === 'string' 
            ? nextQuestion.substring(0, 50) + "..." 
            : "All questions answered";
          console.log(`[CLARIFICATION] Returning next question: "${questionPreview}"`);
          return {
            content: [{
              type: "text",
              text: `Response recorded. ${nextQuestion}`
            }]
          };
        } else {
          // All questions answered
          console.log(`[CLARIFICATION] All questions answered`);
          return {
            content: [{
              type: "text",
              text: "All clarification questions have been answered. You can now generate a PRD for this feature."
            }]
          };
        }
      } catch (error) {
        if (error instanceof z.ZodError) {
          const errorMessage = error.errors.map(e => `${e.path.join('.')}: ${e.message}`).join(', ');
          return createToolErrorResponse(`Validation error: ${errorMessage}`);
        }
        return createToolErrorResponse(error instanceof Error ? error.message : "Unknown error");
      }
    };
  • Zod schema defining the input parameters for the provide_clarification tool: featureId, question, and answer.
    const ProvideClarificationSchema = z.object({
      featureId: z.string().min(1),
      question: z.string().min(1),
      answer: z.string().min(1)
    });
  • Registration of the 'provide_clarification' tool in the toolRegistry, including name, handler, description, JSON schema, and examples.
    toolRegistry.register(
      'provide_clarification', 
      provideClarificationHandler,
      'Provide answer to a clarification question',
      {
        type: "object",
        properties: {
          featureId: {
            type: "string",
            description: "ID of the feature"
          },
          question: {
            type: "string",
            description: "Clarification question"
          },
          answer: {
            type: "string",
            description: "Answer to the clarification question"
          }
        },
        required: ["featureId", "question", "answer"]
      },
      [
        {
          featureId: "feature-123",
          question: "What problem does this feature solve?",
          answer: "This feature solves the problem of users forgetting their passwords by providing a secure password reset flow."
        },
        {
          featureId: "feature-456",
          question: "Who are the target users?",
          answer: "The target users are administrators who need to manage user accounts and permissions."
        }
      ]
    );
  • Alternative direct implementation of the 'provide_clarification' tool using server.tool, with inline schema and handler logic similar to tool-handlers.ts.
    server.tool(
      "provide_clarification",
      {
        featureId: z.string().min(1),
        question: z.string().min(1),
        answer: z.string().min(1)
      },
      async ({ featureId, question, answer }) => {
        // Get the feature
        const feature = getFeature(featureId);
        if (!feature) {
          throw new Error(`Feature ${featureId} not found`);
        }
        
        // Add the clarification response to the feature
        feature.clarificationResponses.push({
          question,
          answer,
          timestamp: new Date()
        });
        
        // Save the feature with the updated clarification response
        updateFeature(featureId, feature);
        
        // Get the next question or indicate all questions are answered
        const nextQuestion = getNextClarificationQuestion(feature);
        
        if (nextQuestion) {
          return {
            content: [{
              type: "text",
              text: `Response recorded. ${nextQuestion}`
            }]
          };
        } else {
          // All questions answered
          return {
            content: [{
              type: "text",
              text: "All clarification questions have been answered. You can now generate a PRD for this feature."
            }]
          };
        }

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/crazyrabbitLTC/mcp-vibecoder'

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