reflect_task
Evaluate and optimize technical analysis results for completeness and alignment with best practices, using high-level pseudocode where necessary to outline logic flow and key steps.
Instructions
Critically review analysis results, evaluate solution completeness and identify optimization opportunities, ensuring the solution aligns with best practices. If code is needed, use pseudocode format providing only high-level logic flow and key steps, avoiding complete code.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| analysis | Yes | Comprehensive technical analysis results, including all technical details, dependent components and implementation plans, if code is needed use pseudocode format and only provide high-level logic flow and key steps avoiding complete code | |
| summary | Yes | Structured task summary, keeping consistent with the analysis phase to ensure continuity |
Implementation Reference
- src/tools/taskTools.ts:183-201 (handler)The core handler function for the 'reflect_task' tool. It receives summary and analysis inputs, generates a specialized reflection prompt using getReflectTaskPrompt, and returns it as structured content for the AI model.export async function reflectTask({ summary, analysis, }: z.infer<typeof reflectTaskSchema>) { // Use prompt generator to get the final prompt const prompt = getReflectTaskPrompt({ summary, analysis, }); return { content: [ { type: "text" as const, text: prompt, }, ], }; }
- src/tools/taskTools.ts:166-182 (schema)Zod schema validating the input arguments for reflect_task: 'summary' (min 10 chars) and 'analysis' (min 100 chars). Used for input parsing in the handler and tool registration.export const reflectTaskSchema = z.object({ summary: z .string() .min(10, { message: "Task summary cannot be less than 10 characters, please provide a more detailed description to ensure clear task objectives", }) .describe("Structured task summary, keeping consistent with the analysis phase to ensure continuity"), analysis: z .string() .min(100, { message: "Technical analysis content is not detailed enough, please provide complete technical analysis and implementation plan", }) .describe( "Comprehensive technical analysis results, including all technical details, dependent components and implementation plans, if code is needed use pseudocode format and only provide high-level logic flow and key steps avoiding complete code" ), });
- src/index.ts:242-247 (registration)Tool registration in the MCP server's ListToolsRequestHandler. Registers 'reflect_task' with its description from template and input schema converted to JSON schema.name: "reflect_task", description: loadPromptFromTemplate( "toolsDescription/reflectTask.md" ), inputSchema: zodToJsonSchema(reflectTaskSchema), },
- src/index.ts:408-418 (registration)Tool invocation handler in the MCP server's CallToolRequestHandler switch statement. Validates arguments using reflectTaskSchema and calls the reflectTask function.case "reflect_task": parsedArgs = await reflectTaskSchema.safeParseAsync( request.params.arguments ); if (!parsedArgs.success) { throw new Error( `Invalid arguments for tool ${request.params.name}: ${parsedArgs.error.message}` ); } result = await reflectTask(parsedArgs.data); return result;
- Helper function that generates the reflection prompt by loading a template, interpolating summary and analysis parameters, and applying custom prompt overrides if available.export function getReflectTaskPrompt(params: ReflectTaskPromptParams): string { const indexTemplate = loadPromptFromTemplate("reflectTask/index.md"); const prompt = generatePrompt(indexTemplate, { summary: params.summary, analysis: params.analysis, }); // Load possible custom prompt return loadPrompt(prompt, "REFLECT_TASK"); }