Skip to main content
Glama

Vibe-Coder MCP Server

get_next_phase_action

Determines the next step in the coding workflow by analyzing the current feature, enabling structured development and progress tracking for LLM-based projects.

Input Schema

NameRequiredDescriptionDefault
featureIdYes

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "featureId": { "minLength": 1, "type": "string" } }, "required": [ "featureId" ], "type": "object" }

Implementation Reference

  • The primary handler function that executes the get_next_phase_action tool logic. It validates the featureId, locates the current phase, assesses task completion, and provides guidance on the next development action.
    const getNextPhaseActionHandler: ToolHandler<z.infer<typeof GetNextPhaseActionSchema>> = async (params) => { try { const { featureId } = GetNextPhaseActionSchema.parse(params); // Validate feature ID const featureResult = validateFeatureId(featureId); if (!featureResult.valid) { return createToolErrorResponse(featureResult.message); } const feature = featureResult.data; // Find the current active phase (first non-completed/reviewed phase) const currentPhase = feature.phases.find((p: Phase) => p.status === 'pending' || p.status === 'in_progress'); if (!currentPhase) { // All phases are completed or reviewed return { content: [{ type: "text", text: 'All phases are completed or reviewed. The feature implementation is done!' }] }; } // Check task completion status const completedTasks = currentPhase.tasks.filter((t: Task) => t.completed); const pendingTasks = currentPhase.tasks.filter((t: Task) => !t.completed); // Determine next action based on phase and task status let message = ''; if (currentPhase.status === 'pending') { message = `Phase "${currentPhase.name}" is pending. Start working on this phase by setting its status to "in_progress".`; } else if (currentPhase.status === 'in_progress') { if (pendingTasks.length > 0) { message = `${completedTasks.length}/${currentPhase.tasks.length} tasks are completed in phase "${currentPhase.name}". Continue working on pending tasks.`; } else if (currentPhase.tasks.length === 0) { message = `Phase "${currentPhase.name}" has no tasks defined. Add tasks or mark the phase as completed if appropriate.`; } else { // All tasks are completed message = `All tasks in phase "${currentPhase.name}" are completed. Consider marking this phase as completed.`; } } return { content: [{ type: "text", text: message }] }; } 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 input schema for the get_next_phase_action tool, defining the required featureId parameter.
    // Schema for get_next_phase_action const GetNextPhaseActionSchema = z.object({ featureId: z.string().min(1) });
  • Registration of the get_next_phase_action tool handler with the tool registry, including description, JSON schema, and example inputs.
    toolRegistry.register( 'get_next_phase_action', getNextPhaseActionHandler, 'Get guidance on what to do next in the current phase or whether to move to the next phase', { type: 'object', properties: { featureId: { type: 'string', description: 'ID of the feature' } }, required: ['featureId'] }, [ { featureId: "feature-123" } ] );
  • Inline handler and registration for get_next_phase_action directly on the MCP server using server.tool(). Provides similar logic but with additional checks for implementation plan and phase existence.
    server.tool( "get_next_phase_action", { featureId: z.string().min(1) }, async ({ featureId }) => { const feature = getFeature(featureId); if (!feature) { throw new Error(`Feature ${featureId} not found`); } // Check if we need implementation plan first if (!feature.implementationPlan) { return { content: [{ type: "text", text: "You should generate an implementation plan before creating phases." }] }; } // If no phases, suggest creating first phase if (feature.phases.length === 0) { return { content: [{ type: "text", text: "You should create the first development phase based on the implementation plan." }] }; } // Find the current active phase (the first non-completed phase) const currentPhase = feature.phases.find(p => p.status !== 'completed' && p.status !== 'reviewed'); if (!currentPhase) { return { content: [{ type: "text", text: "All phases are complete. You should mark the final phase as reviewed." }] }; } // Check if all tasks in the phase are completed const allTasksCompleted = currentPhase.tasks.every(t => t.completed); if (currentPhase.tasks.length === 0) { return { content: [{ type: "text", text: `Current phase "${currentPhase.name}" has no tasks. You should add tasks based on the implementation plan.` }] }; } else if (!allTasksCompleted) { const pendingTasks = currentPhase.tasks.filter(t => !t.completed); return { content: [{ type: "text", text: `Current phase "${currentPhase.name}" has ${pendingTasks.length} incomplete tasks. Complete these tasks before moving to the next phase.` }] }; } else { return { content: [{ type: "text", text: `All tasks in the current phase "${currentPhase.name}" are complete. You can now mark this phase as completed and proceed to the next phase.` }] }; } } );

Other Tools

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

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