Skip to main content
Glama

start_workflow

Initiate workflow execution sessions with step-by-step control to manage complex, multi-step processes through structured, reusable task paths.

Instructions

Start a workflow execution session with step-by-step control

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
inputsNo

Implementation Reference

  • The main handler function for the 'start_workflow' tool. It validates the input, retrieves the workflow, creates an execution session, and generates instructions for the first step.
    private async startWorkflow(args: unknown) { const parsed = StartWorkflowSchema.parse(args); const workflow = await this.storage.get(parsed.id); if (!workflow) { throw new Error(`Workflow not found: ${parsed.id}`); } if (workflow.is_deleted) { throw new Error('Cannot run deleted workflow'); } // Validate inputs const inputs = parsed.inputs || {}; const inputValidation = WorkflowValidator.validateInputs(workflow, inputs); if (!inputValidation.success) { throw new Error(`Input validation failed: ${inputValidation.error}`); } // Create new execution session const executionId = uuidv4(); const session: WorkflowSession = { workflow_id: workflow.id, execution_id: executionId, workflow_name: workflow.name, current_step_index: 0, total_steps: workflow.steps.length, variables: { ...inputs }, status: 'active', started_at: new Date().toISOString(), step_outputs: {}, previous_variables: {}, }; this.sessions.set(executionId, session); // Generate instructions for the first step const firstStep = workflow.steps[0]; const stepInstructions = this.generateStepInstructions(workflow, firstStep, session); return { content: [ { type: 'text', text: stepInstructions, }, ], }; }
  • Zod schema defining the input structure for the 'start_workflow' tool: workflow ID and optional inputs.
    const StartWorkflowSchema = z.object({ id: z.string(), inputs: z.record(z.any()).optional(), });
  • src/index.ts:277-281 (registration)
    Registration of the 'start_workflow' tool in the getTools() method, including name, description, and input schema.
    { name: 'start_workflow', description: 'Start a workflow execution session with step-by-step control', inputSchema: zodToJsonSchema(StartWorkflowSchema), },
  • src/index.ts:132-133 (registration)
    Dispatch registration in the CallToolRequestSchema handler switch statement that routes 'start_workflow' calls to the handler method.
    case 'start_workflow': return await this.startWorkflow(args);

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/FiveOhhWon/workflows-mcp'

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