Skip to main content
Glama
ycyun

ABLESTACK MOLD MCP Server

by ycyun

mold_waitForJob

Waits for an async job to complete or fail by periodically polling queryAsyncJobResult until the job finishes.

Instructions

queryAsyncJobResult를 주기적으로 호출하여 완료(1)/실패(2)까지 대기.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jobidYes
timeoutMsNo
intervalMsNo

Implementation Reference

  • Handler function that polls the asynchronous job status using queryAsyncJobResult until it completes (status 1) or fails (status 2), with configurable timeout and polling interval.
    async ({ jobid, timeoutMs = 60000, intervalMs = 2000 }) => {
      const start = Date.now();
      while (true) {
        const data = await callApi("queryAsyncJobResult", { jobid });
        const resp = data.queryasyncjobresultresponse ?? data.queryasyncjobresult ?? data;
        const status = resp.jobstatus;
        if (status === 1 || status === 2) {
          return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
        }
        if (Date.now() - start > timeoutMs) throw new Error(`timeout after ${timeoutMs}ms`);
        await new Promise((r) => setTimeout(r, intervalMs));
      }
    }
  • Registration of the mold_waitForJob tool within the registerCoreTools function, including title, description, input schema, and inline handler.
    server.registerTool(
      "mold_waitForJob",
      {
        title: "비동기 잡 완료 대기",
        description: "queryAsyncJobResult를 주기적으로 호출하여 완료(1)/실패(2)까지 대기.",
        inputSchema: {
          jobid: z.string(),
          timeoutMs: z.number().int().optional(),
          intervalMs: z.number().int().optional(),
        },
      },
      async ({ jobid, timeoutMs = 60000, intervalMs = 2000 }) => {
        const start = Date.now();
        while (true) {
          const data = await callApi("queryAsyncJobResult", { jobid });
          const resp = data.queryasyncjobresultresponse ?? data.queryasyncjobresult ?? data;
          const status = resp.jobstatus;
          if (status === 1 || status === 2) {
            return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
          }
          if (Date.now() - start > timeoutMs) throw new Error(`timeout after ${timeoutMs}ms`);
          await new Promise((r) => setTimeout(r, intervalMs));
        }
      }
    );
  • Zod input schema defining jobid (required string), timeoutMs and intervalMs (optional integers).
    inputSchema: {
      jobid: z.string(),
      timeoutMs: z.number().int().optional(),
      intervalMs: z.number().int().optional(),
    },

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/ycyun/ablestack-MCP-server'

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