Skip to main content
Glama

wait

Pause execution for a specified duration (0-300 seconds) to synchronize tasks, ensuring dependent processes complete before proceeding. Ideal for task orchestration and workflow management.

Instructions

Wait for a specified number of seconds, useful for waiting for other tasks to finish

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
secondsYesThe number of seconds to wait (0-300)

Implementation Reference

  • The execute handler for the 'wait' tool, which waits for the specified seconds, reports progress every 10%, and returns a success message.
    execute: async (args, { reportProgress }) => {
      const { seconds } = args;
      const ms = seconds * 1000;
    
      console.log(`Waiting for ${seconds} seconds...`);
    
      // Report progress in 10% increments
      const interval = ms / 10;
    
      for (let i = 0; i < 10; i++) {
        await sleep(interval);
        reportProgress({
          progress: (i + 1) * 10,
          total: 100,
        });
      }
    
      return `Waited for ${seconds} seconds successfully.`;
    },
  • Zod schema defining the input parameters for the 'wait' tool: seconds (number, 0-30000).
    parameters: z.object({
      seconds: z.number().min(0).max(30000).describe("The number of seconds to wait (0-30000)"),
    }),
  • src/index.ts:21-46 (registration)
    Registration of the 'wait' tool using server.addTool, including name, description, schema, and handler.
    server.addTool({
      name: "wait",
      description: "Wait for a specified number of seconds, useful for waiting for other tasks to finish",
      parameters: z.object({
        seconds: z.number().min(0).max(30000).describe("The number of seconds to wait (0-30000)"),
      }),
      execute: async (args, { reportProgress }) => {
        const { seconds } = args;
        const ms = seconds * 1000;
    
        console.log(`Waiting for ${seconds} seconds...`);
    
        // Report progress in 10% increments
        const interval = ms / 10;
    
        for (let i = 0; i < 10; i++) {
          await sleep(interval);
          reportProgress({
            progress: (i + 1) * 10,
            total: 100,
          });
        }
    
        return `Waited for ${seconds} seconds successfully.`;
      },
    });
  • Helper sleep function used by the wait handler to pause execution.
    function sleep(ms: number): Promise<void> {
      return new Promise(resolve => setTimeout(resolve, ms));
    }
Install Server

Other Tools

Related 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/automation-ai-labs/mcp-wait'

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