refactor_workflow
Initiate a structured refactoring workflow to enhance code quality while preserving functionality. Define the task, scope, and constraints for targeted, verified improvements.
Instructions
Start a structured refactoring workflow to improve existing code without changing functionality
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Additional context (optional) | |
| task | Yes | Description of what you want to refactor |
Implementation Reference
- src/tools/refactorWorkflow.ts:43-55 (handler)The handleRefactorWorkflow function implements the core execution logic for the 'refactor_workflow' tool by calling executeWorkflow with workflowType: '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:5-41 (schema)The createRefactorWorkflowTool function returns the Tool object defining the name 'refactor_workflow', description, and inputSchema with required 'task' and optional 'context'.export function createRefactorWorkflowTool(): Tool { return { name: 'refactor_workflow', description: 'Start a structured refactoring workflow to improve existing code without changing functionality', 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:13-13 (registration)Import of the tool creator (createRefactorWorkflowTool) and handler (handleRefactorWorkflow) functions.import { createRefactorWorkflowTool, handleRefactorWorkflow } from './tools/refactorWorkflow.js';
- src/index.ts:139-139 (registration)The tool is registered in the main tools array by calling createRefactorWorkflowTool().createRefactorWorkflowTool(), // Refactoring workflow
- src/index.ts:226-232 (registration)Dispatch registration: switch case for 'refactor_workflow' invokes the handler function.case 'refactor_workflow': return { content: [{ type: 'text', text: JSON.stringify(await handleRefactorWorkflow(args as any, sessionManager), null, 2) }] };