provide-clarification
Generate precise clarification responses to user queries by analyzing question indexes and provided answers, enhancing clarity in AI-driven dialogue systems.
Instructions
Provide a clarification answer
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| answer | Yes | ||
| questionIndex | Yes |
Implementation Reference
- Core handler logic for the 'provide-clarification' tool: processes user answer for a specific question index, updates the project clarification responses, saves the project state, and returns the next question or completion status.async provideClarification( questionIndex: number, answer: string ): Promise<{ success: boolean; nextQuestion?: string; isComplete: boolean; message: string }> { const project = this.loadCurrentProject(); if (!project) { throw new Error('No active project found. Please start clarification first.'); } const clarificationResponse: ClarificationResponse = { question: DEFAULT_CLARIFICATION_QUESTIONS[questionIndex], answer, timestamp: new Date() }; if (!project.clarificationResponses) { project.clarificationResponses = []; } project.clarificationResponses.push(clarificationResponse); project.updatedAt = new Date(); this.saveCurrentProject(project); const nextIndex = questionIndex + 1; if (nextIndex >= DEFAULT_CLARIFICATION_QUESTIONS.length) { return { success: true, isComplete: true, message: `✅ Project clarification complete! You can now generate the PRD.` }; } return { success: true, nextQuestion: DEFAULT_CLARIFICATION_QUESTIONS[nextIndex], isComplete: false, message: `✅ Answer recorded. Next question:` }; }
- MCP CallToolRequestSchema handler case for 'provide-clarification': validates input arguments using Zod, invokes the core provideClarification method, and formats the MCP response content.case 'provide-clarification': { const { questionIndex, answer } = z.object({ questionIndex: z.number(), answer: z.string() }).parse(args); const result = await contextManager.provideClarification(questionIndex, answer); let text = result.message; if(result.nextQuestion) { text += `\n\nNext question: ${result.nextQuestion}`; } return { content: [{ type: 'text', text }] }; }
- vibe-services/context-manager/index.ts:199-210 (registration)Tool registration in ListToolsRequestSchema response: defines name, description, and input schema for 'provide-clarification'.{ name: 'provide-clarification', description: 'Provide a clarification answer', inputSchema: { type: 'object', properties: { questionIndex: { type: 'number' }, answer: { type: 'string' } }, required: ['questionIndex', 'answer'] } },
- Input schema definition for the 'provide-clarification' tool, specifying questionIndex (number) and answer (string) as required properties.{ name: 'provide-clarification', description: 'Provide a clarification answer', inputSchema: { type: 'object', properties: { questionIndex: { type: 'number' }, answer: { type: 'string' } }, required: ['questionIndex', 'answer'] } },