Skip to main content
Glama

wait-seconds

Introduces delays in blockchain interactions by pausing execution for a specified number of seconds, enabling controlled timing for transaction sequences and automated workflows.

Instructions

Wait the given seconds

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
secondsYes

Implementation Reference

  • The async execute function that implements the core logic of the wait-seconds tool by waiting the specified seconds using the wait helper and returning a text confirmation.
    execute: async (args) => {
      const seconds = args.seconds
      await wait(seconds * 1000)
      return {
        content: [
          {
            type: "text",
            text: `Wait for ${seconds} seconds`,
          },
        ],
      }
    },
  • Zod schema defining the input parameters for the tool, specifically 'seconds' coerced to number.
    parameters: z.object({
      seconds: z.coerce.number()
    }),
  • The registration of the 'wait-seconds' tool via server.addTool, including name, description, schema, and handler reference.
    server.addTool({
      name: "wait-seconds",
      description: "Wait the given seconds",
      parameters: z.object({
        seconds: z.coerce.number()
      }),
      execute: async (args) => {
        const seconds = args.seconds
        await wait(seconds * 1000)
        return {
          content: [
            {
              type: "text",
              text: `Wait for ${seconds} seconds`,
            },
          ],
        }
      },
    });
  • Helper function that performs the asynchronous wait using Promise and setTimeout.
    async function wait(timeout: number) {
      return new Promise((resolve) => {
        setTimeout(() => {
          resolve(undefined)
        }, timeout)
      })
    }

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/Xiawpohr/mcpilot'

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