Skip to main content
Glama
Linked-API
by Linked-API

get_workflow_result

Retrieve the final result of a background workflow by providing its workflow ID and operation name, continuing to listen for updates until completion.

Instructions

CONTINUE LISTENING TO BACKGROUND WORKFLOW - THIS IS NORMAL OPERATION! Background workflows are OPTIMAL BEHAVIOR for Linked API operations and keep the MCP client responsive. When a workflow runs in the background, this tool should be used with the provided workflowId and operationName parameters to continue listening for updates. The workflow continues processing in the background while you wait. This is the STANDARD way Linked API works - background processing provides optimal user experience!

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workflowIdYesThe workflow ID provided in the background workflow status message
operationNameYesOptional function name for proper type restoration (provided in background workflow status if available)

Implementation Reference

  • The execute() method of GetWorkflowResultTool that runs the tool logic. It looks up the LinkedApi operation by operationName, then calls executeWithProgress with the provided workflowId to poll for the workflow result.
    public override async execute({
      linkedapi,
      args: { workflowId, operationName },
      workflowTimeout,
      progressToken,
    }: {
      linkedapi: LinkedApi;
      args: IGetWorkflowResultParams;
      workflowTimeout: number;
      progressToken?: string | number;
    }): Promise<TMappedResponse<unknown>> {
      const operation = linkedapi.operations.find(
        (operation) => operation.operationName === operationName,
      )!;
      return await executeWithProgress(this.progressCallback, operation, workflowTimeout, {
        workflowId,
        progressToken,
      });
    }
  • Zod schema definition for the tool's IGetWorkflowResultParams interface: workflowId (string) and operationName (enum from OPERATION_NAME values). Also includes the getTool() method returning the Tool inputSchema definition.
    public readonly name = 'get_workflow_result';
    protected readonly schema = z.object({
      workflowId: z.string(),
      operationName: z.enum(Object.values(OPERATION_NAME)),
    });
  • The executeWithProgress helper function called by GetWorkflowResultTool.execute(). When workflowId is provided (as it is from get_workflow_result), it skips operation.execute() and directly calls operation.result(workflowId) to poll for the workflow's final result, sending progress notifications along the way.
    export async function executeWithProgress<TParams, TResult>(
      progressCallback: (progress: LinkedApiProgressNotification) => void,
      operation: Operation<TParams, TResult>,
      workflowTimeout: number,
      {
        params,
        workflowId,
        progressToken,
      }: { params?: TParams; workflowId?: string; progressToken?: string | number } = {},
    ): Promise<TMappedResponse<TResult>> {
      let progress = 0;
    
      progressCallback({
        progressToken,
        progress,
        total: 100,
        message: `Starting workflow ${operation.operationName}...`,
      });
    
      const interval = setInterval(
        () => {
          if (progress < 50) {
            progress += 5;
          } else if (progress < 98) {
            progress += 1;
          }
    
          progressCallback({
            progressToken,
            progress,
            total: 100,
            message: `Executing workflow ${operation.operationName}...`,
          });
        },
        Math.max(workflowTimeout / 20, 10000),
      );
    
      try {
        if (!workflowId) {
          workflowId = await operation.execute(params as TParams);
        }
        const result = await operation.result(workflowId, {
          timeout: workflowTimeout,
        });
        clearInterval(interval);
    
        progressCallback({
          progressToken,
          progress: 100,
          total: 100,
          message: `Workflow ${operation.operationName} completed successfully`,
        });
    
        return result;
      } catch (error) {
        clearInterval(interval);
        if (error instanceof LinkedApiWorkflowTimeoutError) {
          throw generateTimeoutError(error);
        }
    
        throw error;
      }
    }
  • Registration of GetWorkflowResultTool in the LinkedApiTools constructor. It's instantiated with a progressCallback and added to the tools list at line 76.
      new GetWorkflowResultTool(progressCallback),
      new GetApiUsageTool(progressCallback),
    ];
  • The generateTimeoutError helper function. If the workflow times out, it enriches the error message with instructions to call get_workflow_result with the specific workflowId and operationName parameters.
    function generateTimeoutError(error: LinkedApiWorkflowTimeoutError) {
      const restoreMessage = `Workflow is running in the background. Continue listening for updates.
    
    ACTION REQUIRED (MCP CLIENT):
    - Do not retry the original tool; the workflow is already running
    - Call the get_workflow_result tool with the parameters below and keep listening until completion
    
    PARAMETERS TO USE:
    - workflowId: ${error.workflowId}
    - operationName: ${error.operationName}
    
    GENERIC MCP CALL EXAMPLE:
    {
      "name": "get_workflow_result",
      "arguments": {
        "workflowId": "${error.workflowId}",
        "operationName": "${error.operationName}"
      }
    }
    
    Background processing keeps the MCP client responsive while the workflow completes.`;
    
      error.message = restoreMessage;
      return error;
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden. It explains that the tool is for listening and that background processing keeps the client responsive. However, it does not disclose rate limits, timeouts, or failure behaviors.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is overly verbose with all-caps emphasis and repeated phrases like 'THIS IS NORMAL OPERATION!' and 'OPTIMAL BEHAVIOR'. It could be more concise while retaining clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no output schema, the description fails to explain what the tool returns or how updates are delivered (e.g., polling vs streaming). This gap reduces completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and the description adds context: workflowId comes from a background status message, and operationName is optional for type restoration. This augments the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool is for continuing to listen to background workflows, with a specific verb ('CONTINUE LISTENING') and resource ('BACKGROUND WORKFLOW'). It distinguishes itself from siblings like execute_custom_workflow by explaining it handles background processing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use the tool ('when a workflow runs in the background') and provides parameters to use. However, it lacks explicit guidance on when not to use it or alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Linked-API/linkedapi-mcp'

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