Home/Tools/@tpmjs/tools-workflow-validate-io

workflowValidateIO

@tpmjs/tools-workflow-validate-io

Validates that workflow step inputs/outputs are compatible and checks type chains between steps

Official
agent
v0.2.0
MIT
⚠️

This tool is currently broken

Import Failed
Cannot load from Railway service
Export "workflowValidateIO" not found in module

Last checked: 1/1/2026, 8:18:10 AM

Interactive Playground

Test @tpmjs/tools-workflow-validate-io (workflowValidateIO) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install @tpmjs/tools-workflow-validate-io
pnpm add @tpmjs/tools-workflow-validate-io
yarn add @tpmjs/tools-workflow-validate-io
bun add @tpmjs/tools-workflow-validate-io
deno add npm:@tpmjs/tools-workflow-validate-io

2. Import the tool

import { workflowValidateIO } from '@tpmjs/tools-workflow-validate-io';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { workflowValidateIO } from '@tpmjs/tools-workflow-validate-io';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { workflowValidateIO },
  prompt: 'Your prompt here...',
});

console.log(result.text);

Parameters

Available configuration options

Author-provided
workflow
Required
Type: object

Workflow object with steps array, each step has inputs and outputs

Try to auto-extract schema from the package

README

@tpmjs/tools-workflow-validate-io

Validates that workflow step inputs/outputs are compatible and checks type chains between steps.

Features

  • Type Compatibility Checking: Validates that connected steps have compatible input/output types
  • Source Validation: Ensures input sources reference existing step outputs
  • Comprehensive Error Reporting: Provides detailed error and warning messages with step context
  • Flexible Type System: Supports basic types, arrays, objects, and 'any' type
  • Unused Output Detection: Warns about outputs that are never consumed by subsequent steps

Installation

npm install @tpmjs/tools-workflow-validate-io

Usage

import { workflowValidateIOTool } from '@tpmjs/tools-workflow-validate-io';

const workflow = {
  steps: [
    {
      id: 'fetch-data',
      outputs: {
        data: { type: 'object' },
        count: { type: 'number' }
      }
    },
    {
      id: 'process-data',
      inputs: {
        rawData: { type: 'object', source: 'fetch-data.data' },
        threshold: { type: 'number', source: 'fetch-data.count' }
      },
      outputs: {
        result: { type: 'string' }
      }
    },
    {
      id: 'send-result',
      inputs: {
        message: { type: 'string', source: 'process-data.result' }
      }
    }
  ]
};

const result = await workflowValidateIOTool.execute({ workflow });

console.log(result);
// {
//   valid: true,
//   issues: [],
//   stepCount: 3
// }

Workflow Structure

Each workflow step should have:

  • id (required): Unique identifier for the step
  • name (optional): Human-readable name
  • inputs (optional): Object where keys are input names and values contain:
    • type (required): Expected type (string, number, object, array, any, etc.)
    • source (optional): Reference to output in format "stepId.outputName"
  • outputs (optional): Object where keys are output names and values contain:
    • type (required): Output type

Type Compatibility

The validator supports:

  • Exact matches: stringstring
  • Any type: any is compatible with all types
  • Array compatibility: string[]array
  • Object compatibility: object{ ... }
  • Number/Integer: numberinteger

Validation Issues

The tool reports two severity levels:

Errors (prevent valid: true)

  • Missing step IDs
  • Missing type definitions
  • Unknown source references
  • Type mismatches between connected steps

Warnings (don't prevent valid: true)

  • Steps with no inputs or outputs
  • Outputs never used by subsequent steps (except final step)

Example with Errors

const invalidWorkflow = {
  steps: [
    {
      id: 'step1',
      outputs: {
        result: { type: 'string' }
      }
    },
    {
      id: 'step2',
      inputs: {
        data: { type: 'number', source: 'step1.result' } // Type mismatch!
      }
    }
  ]
};

const result = await workflowValidateIOTool.execute({ workflow: invalidWorkflow });

console.log(result);
// {
//   valid: false,
//   issues: [
//     {
//       stepId: 'step2',
//       stepIndex: 1,
//       severity: 'error',
//       message: "Type mismatch: Input 'data' expects type 'number' but source 'step1.result' from step 'step1' (index 0) outputs type 'string'",
//       field: 'data'
//     }
//   ],
//   stepCount: 2
// }

Use Cases

  • Agent Systems: Validate tool chains before execution
  • Workflow Builders: Real-time validation in visual workflow editors
  • CI/CD: Validate workflow definitions in automated pipelines
  • Documentation: Generate workflow diagrams with validated connections

License

MIT

Statistics

Downloads/month

61

Quality Score

79%

Bundle Size

NPM Keywords

tpmjs
workflow
agent
validation

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai