Skip to main content
Glama
kingdomseed

Structured Workflow MCP

by kingdomseed

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
NameRequiredDescriptionDefault
taskYesDescription of what you want to refactor
contextNoAdditional context (optional)

Implementation Reference

  • 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
      );
    }
  • 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)
        }]
      };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'start a structured refactoring workflow' but doesn't explain what this entails—whether it's interactive, batch-based, requires specific permissions, has side effects, or how it handles errors. For a tool with no annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. It's appropriately sized for the tool's complexity, with every part contributing to understanding the tool's intent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a refactoring workflow tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits, expected outcomes, error handling, or how it integrates with sibling tools, leaving the agent with insufficient context to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('task' and 'context') thoroughly. The description doesn't add any parameter-specific details beyond what's in the schema, such as examples or usage tips, but with high schema coverage, a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Start') and resource ('structured refactoring workflow'), explaining it's for improving existing code without changing functionality. However, it doesn't explicitly differentiate from sibling tools like 'refactor_guidance', which might serve a similar purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools like 'refactor_guidance', 'audit_inventory_guidance', and 'lint_guidance' that might overlap in code improvement contexts, there's no explicit when/when-not usage or alternative recommendations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/kingdomseed/structured-workflow-mcp'

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