Skip to main content
Glama
kingdomseed

Structured Workflow MCP

by kingdomseed

refactor_guidance

Provides structured guidance for implementing code changes during the WRITE/REFACTOR phase to enforce disciplined programming practices.

Instructions

Get guidance for the WRITE/REFACTOR phase - implementing changes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Dispatch handler for refactor_guidance (and other phase guidance tools). Invokes the shared handlePhaseGuidance function with the tool name and session manager.
    case 'setup_guidance':
    case 'audit_inventory_guidance':
    case 'compare_analyze_guidance':
    case 'question_determine_guidance':
    case 'refactor_guidance':
    case 'lint_guidance':
    case 'iterate_guidance':
    case 'present_guidance':
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(await handlePhaseGuidance(name, sessionManager), null, 2)
        }]
      };
  • Tool schema definition including name, description, and input schema for refactor_guidance.
    {
      name: 'refactor_guidance',
      description: 'Get guidance for the WRITE/REFACTOR phase - implementing changes',
      inputSchema: { type: 'object', properties: {} }
  • src/index.ts:145-147 (registration)
    Registration of phase guidance tools (including refactor_guidance) in the main tools array.
    // Phase guidance tools
    ...createPhaseGuidanceTools(),                // Handles both suggestive and directive modes
    createTestGuidanceTool(),                     // TEST phase guidance
  • Core handler function for all phase guidance tools, including refactor_guidance. Determines mode (directive/suggestive) and routes to appropriate guidance generator.
    export async function handlePhaseGuidance(
      phaseName: string,
      sessionManager: SessionManager
    ): Promise<PhaseGuidance> {
      const session = sessionManager.getSession();
      const isDirectiveMode = session?.workflowConfig !== undefined;
      
      // Route to appropriate guidance based on mode
      if (isDirectiveMode) {
        return getDirectiveGuidance(phaseName, sessionManager);
      } else {
        return getSuggestiveGuidance(phaseName, sessionManager);
      }
    }
  • Specific guidance content and instructions for refactor_guidance tool in suggestive mode.
    refactor_guidance: {
      phase: 'WRITE_OR_REFACTOR',
      objective: 'Implement the planned changes',
      instructions: [
        'Follow your implementation plan from DETERMINE_PLAN',
        'Use your file editing tools to make changes',
        'Remember: you must read files before modifying them',
        'Make changes incrementally',
        'Test frequently if possible',
        'Keep track of what you\'ve changed'
      ],
      suggestedApproach: [
        'Start with one logical unit of change',
        'Verify it works before moving on',
        'Make related changes together',
        'Use version control effectively',
        'Comment on any non-obvious changes'
      ],
      importantNotes: [
        'If you haven\'t read a file yet, read it first',
        'Don\'t try to change everything at once',
        'Keep a list of files you\'ve modified'
      ],
      expectedOutput: {
        filesModified: 'Complete list of changed files',
        changesPerFile: 'Summary of changes in each file',
        testsRun: 'Any tests executed during refactoring',
        issues: 'Any problems encountered',
        deviations: 'Any changes from the original plan'
      },
      nextPhase: 'Use lint_guidance to verify your changes',
      prerequisites: {
        completed: ['AUDIT_INVENTORY', 'QUESTION_DETERMINE'],
        warning: session && !session.completedPhases.includes('AUDIT_INVENTORY') 
          ? 'Consider completing AUDIT_INVENTORY phase first to avoid unexpected issues' 
          : null
      }
    },
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. It mentions 'guidance' but doesn't disclose behavioral traits such as whether this is a read-only operation, if it requires specific inputs or context, what the output format might be, or any rate limits. This leaves the agent with insufficient information about how the tool behaves.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads the purpose. It avoids unnecessary words, though it could be slightly more specific to improve clarity without losing conciseness.

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 providing guidance (which likely involves nuanced outputs), no annotations, no output schema, and many sibling tools, the description is incomplete. It doesn't explain what the guidance entails, how it's delivered, or how it differs from other guidance tools, leaving significant gaps for the agent.

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

Parameters4/5

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

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the inputs. The description doesn't need to add parameter information, and it doesn't contradict the schema. Baseline is 4 for zero parameters, as no compensation is needed.

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

Purpose3/5

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

The description states the tool provides 'guidance for the WRITE/REFACTOR phase - implementing changes,' which gives a vague purpose (guidance for a specific phase). It doesn't specify what type of guidance (e.g., code suggestions, best practices) or what resource it acts upon, and doesn't clearly distinguish from siblings like 'refactor_workflow' or 'iterate_guidance.'

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 implies usage during the 'WRITE/REFACTOR phase' but provides no explicit guidance on when to use this tool versus alternatives (e.g., 'refactor_workflow' or 'iterate_guidance'), no exclusions, and no prerequisites. It lacks context for tool selection among many guidance-related siblings.

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