Skip to main content
Glama
kingdomseed

Structured Workflow MCP

by kingdomseed

validate_action

Check if an action follows critical safety rules before performing it on a target file to ensure disciplined programming practices.

Instructions

Check if an action follows critical safety rules

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesThe action you want to take
targetFileYesThe file you want to act on

Implementation Reference

  • The core handler function that implements the validate_action tool logic, enforcing the read-before-modify safety rule and tracking file history.
    export async function handleValidateAction(
      params: { action: string; targetFile: string },
      sessionManager: SessionManager
    ): Promise<ValidationResult> {
      const session = sessionManager.getSession();
      const fileHistory = sessionManager.getFileHistory(params.targetFile);
      
      // Only enforce the critical "read before write" rule
      if (isModificationAction(params.action) && !fileHistory.hasBeenRead) {
        return {
          allowed: false,
          error: 'SAFETY VIOLATION: Cannot modify a file before reading it',
          reason: 'This prevents accidental data loss and ensures informed changes',
          resolution: `First read the file "${params.targetFile}" using any file reading tool, then you can modify it`
        };
      }
      
      // Track file reads and modifications
      if (params.action.toLowerCase().includes('read')) {
        sessionManager.recordFileRead(params.targetFile);
      } else if (isModificationAction(params.action)) {
        sessionManager.recordFileModification(params.targetFile);
      }
      
      // All other actions are allowed
      return {
        allowed: true,
        currentPhase: session?.currentPhase,
        reminder: session 
          ? `You're in ${session.currentPhase} phase. Check ${session.currentPhase.toLowerCase()}_guidance for recommendations.`
          : 'No active session. Consider starting with plan_workflow or build_custom_workflow.'
      };
    }
  • Defines the tool metadata, description, and input schema (action and targetFile required) for validate_action.
    {
      name: 'validate_action',
      description: 'Check if an action follows critical safety rules',
      inputSchema: {
        type: 'object',
        properties: {
          action: {
            type: 'string',
            description: 'The action you want to take'
          },
          targetFile: {
            type: 'string',
            description: 'The file you want to act on'
          }
        },
        required: ['action', 'targetFile']
      }
    },
  • src/index.ts:149-151 (registration)
    Registers the validate_action tool by including the output of createValidationTools() in the server's tools list.
    // Validation tools
    ...createValidationTools(),                   // Both validate_action and validate_phase_completion
  • src/index.ts:258-264 (registration)
    Dispatches tool calls for 'validate_action' to the handleValidateAction function in the main server request handler.
    case 'validate_action':
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(await handleValidateAction(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 states the tool 'checks' safety rules, implying a read-only or validation operation, but does not disclose critical traits such as whether it requires specific permissions, what happens on failure (e.g., errors or warnings), or if it has side effects like logging. For a safety-related tool with zero annotation coverage, this is a significant gap in transparency.

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: 'Check if an action follows critical safety rules.' It is front-loaded with the core purpose, has zero wasted words, and is appropriately sized for the tool's complexity. Every part of the sentence earns its place by clearly stating the tool's function.

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 safety validation, lack of annotations, and no output schema, the description is incomplete. It does not explain what the tool returns (e.g., a pass/fail result, detailed error messages, or safety scores), nor does it cover behavioral aspects like error handling or dependencies. For a tool with two required parameters and no structured output information, the description should provide more context to be fully helpful.

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?

The input schema has 100% description coverage, with clear parameter descriptions ('The action you want to take' and 'The file you want to act on'), so the schema does the heavy lifting. The tool description does not add any meaning beyond what the schema provides—it does not explain how 'action' and 'targetFile' interact or provide examples of valid inputs. Baseline 3 is appropriate as the schema adequately covers parameter semantics.

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: 'Check if an action follows critical safety rules.' It specifies the verb ('Check') and the resource/scope ('action follows critical safety rules'), making it easy to understand what the tool does. However, it does not explicitly distinguish this from sibling tools like 'validate_phase_completion' or 'audit_inventory_guidance', which might also involve validation or safety checks, so it lacks sibling differentiation.

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. It does not mention any context, prerequisites, or exclusions, nor does it refer to sibling tools for comparison. For example, it does not clarify if this is for pre-action validation versus post-action auditing, leaving the agent to infer usage based on the name alone.

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