refactor_workflow
Improve existing code structure without changing functionality by following a structured refactoring workflow that maintains code quality.
Instructions
Start a structured refactoring workflow to improve existing code without changing functionality
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task | Yes | Description of what you want to refactor | |
| context | No | Additional context (optional) |
Implementation Reference
- src/tools/refactorWorkflow.ts:43-55 (handler)The primary handler function that executes the 'refactor_workflow' tool logic by calling the general workflow executor with type 'refactor'.export async function handleRefactorWorkflow( params: { task: string; context?: any }, sessionManager: SessionManager ) { return executeWorkflow( { task: params.task, workflowType: 'refactor', context: params.context }, sessionManager ); }
- src/tools/refactorWorkflow.ts:9-39 (schema)Input schema for the 'refactor_workflow' tool, defining the task parameter as required and optional context with targetFiles, scope, and constraints.inputSchema: { type: 'object', properties: { task: { type: 'string', description: 'Description of what you want to refactor' }, context: { type: 'object', description: 'Additional context (optional)', properties: { targetFiles: { type: 'array', items: { type: 'string' }, description: 'Specific files to refactor' }, scope: { type: 'string', enum: ['file', 'directory', 'project'], description: 'The scope of the refactoring' }, constraints: { type: 'array', items: { type: 'string' }, description: 'Any constraints or requirements' } } } }, required: ['task'] }
- src/index.ts:137-157 (registration)Registration of the 'refactor_workflow' tool via inclusion of createRefactorWorkflowTool() in the server's tools array.const tools = [ // Workflow entry points createRefactorWorkflowTool(), // Refactoring workflow createFeatureWorkflowTool(), // Feature creation workflow createTestWorkflowTool(), // Test writing workflow createTddWorkflowTool(), // TDD workflow createBuildCustomWorkflowTool(), // Custom workflow builder // Phase guidance tools ...createPhaseGuidanceTools(), // Handles both suggestive and directive modes createTestGuidanceTool(), // TEST phase guidance // Validation tools ...createValidationTools(), // Both validate_action and validate_phase_completion // Workflow management createUserInputRequiredTool(), // Escalation handling createWorkflowStatusTool(), // Workflow status createPhaseOutputTool(), // Phase output recording createDiscoverWorkflowToolsTool() // Tool discovery ];
- src/index.ts:226-232 (registration)Dispatch registration in the MCP server's tool call handler switch statement, routing 'refactor_workflow' calls to the handleRefactorWorkflow function.case 'refactor_workflow': return { content: [{ type: 'text', text: JSON.stringify(await handleRefactorWorkflow(args as any, sessionManager), null, 2) }] };