Skip to main content
Glama

continue_run

Provide additional input to a paused run that requires more information to proceed, enabling continued execution of orchestrated coding tasks.

Instructions

Send an additional input message to a run that is waiting for more input.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
run_idYes
input_messageYes

Implementation Reference

  • The continueRun method in RunManager contains the core handler logic for the continue_run tool. It validates the run state, checks if the run is active and awaiting input, creates a resume event, and invokes the adapter's continue method to send additional input to a waiting run.
    async continueRun(input: ContinueRunInput): Promise<ContinueRunResult> {
      const managed = this.findManagedRun(input.run_id);
      if (!managed) {
        throw new Error(`run is not active in this process: ${input.run_id}`);
      }
      if (isTerminalStatus(managed.record.status)) {
        throw new Error(`run is already terminal: ${managed.record.status}`);
      }
      if (managed.record.status !== 'input_required' && managed.record.status !== 'auth_required') {
        throw new Error(`run is not awaiting additional input: ${managed.record.status}`);
      }
      const continueFn = managed.adapter.continue ?? managed.handle.continue;
      if (!continueFn) {
        throw new Error(`backend does not support continue: ${managed.record.backend}`);
      }
    
      const resumedAt = new Date().toISOString();
      const resumeEvent = this.prepareEvent(managed, {
        seq: 0,
        ts: resumedAt,
        run_id: '',
        session_id: managed.record.sessionId,
        backend: managed.record.backend,
        type: 'status_changed',
        data: {
          status: 'running',
          reason: 'continue_run',
        },
      });
      await this.persistEvent(managed, resumeEvent);
    
      if (managed.adapter.continue) {
        await managed.adapter.continue(managed.handle, input.input_message);
      } else {
        await managed.handle.continue?.(input.input_message);
      }
    
      return {
        run_id: managed.record.runId,
        status: managed.record.status,
      };
    }
  • The registerContinueRunTool function registers the 'continue_run' tool with the MCP server, defining its name, description, input/output schemas, and the async handler that wraps the RunManager.continueRun method with error handling.
    export function registerContinueRunTool(server: McpServer, manager: RunManager): void {
      server.registerTool(
        'continue_run',
        {
          description: 'Send an additional input message to a run that is waiting for more input.',
          inputSchema: continueRunSchema,
          outputSchema: continueRunResultSchema,
        },
        async (args) => {
          try {
            const result = await manager.continueRun(args);
            return asToolResult(result);
          } catch (error) {
            return asToolError(String(error));
          }
        },
      );
    }
  • The continueRunSchema defines the input validation schema using Zod, requiring a run_id string and an input_message that conforms to agentMessageSchema.
    export const continueRunSchema = z.object({
      run_id: z.string().min(1),
      input_message: agentMessageSchema,
    });
  • The continueRunResultSchema defines the output validation schema, containing run_id and status fields.
    export const continueRunResultSchema = z.object({
      run_id: z.string(),
      status: runStatusSchema,
    });
  • TypeScript interface definitions for ContinueRunInput (run_id and input_message) and ContinueRunResult (run_id and status) used by the continue_run tool.
    export interface ContinueRunInput {
      run_id: string;
      input_message: AgentMessage;
    }
    
    export interface ContinueRunResult {
      run_id: string;
      status: RunStatus;
    }

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/dufangshi/orchestration-mcp'

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