Skip to main content
Glama
runpod

RunPod MCP Server

Official
by runpod

retry-job

Requeue a failed or timed-out Serverless job by removing its previous output and resetting its status to pending.

Instructions

Retry a failed or timed-out Serverless job. Only works for jobs with FAILED or TIMED_OUT status. The previous output is removed and the job is requeued.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointIdYesID of the Serverless endpoint the job belongs to
jobIdYesID of the job to retry

Implementation Reference

  • The 'retry-job' tool handler registered via server.tool(). It takes endpointId and jobId as params, calls the RunPod Serverless API POST /retry/:jobId endpoint, and returns the JSON result.
    server.tool(
      'retry-job',
      'Retry a failed or timed-out Serverless job. Only works for jobs with FAILED or TIMED_OUT status. The previous output is removed and the job is requeued.',
      {
        endpointId: endpointIdSchema.describe('ID of the Serverless endpoint the job belongs to'),
        jobId: jobIdSchema.describe('ID of the job to retry'),
      },
      async (params) => {
        const result = await serverlessRequest(
          params.endpointId,
          `/retry/${params.jobId}`,
          'POST'
        );
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      }
    );
  • Input schema for retry-job: endpointId (endpointIdSchema) and jobId (jobIdSchema), both validated as alphanumeric strings with regex.
    {
      endpointId: endpointIdSchema.describe('ID of the Serverless endpoint the job belongs to'),
      jobId: jobIdSchema.describe('ID of the job to retry'),
    },
  • Definition of endpointIdSchema: a Zod string validated with regex /^[a-zA-Z0-9_-]+$/.
    const endpointIdSchema = z
      .string()
      .regex(/^[a-zA-Z0-9_-]+$/, 'Invalid endpoint ID format');
  • Definition of jobIdSchema: a Zod string validated with regex /^[a-zA-Z0-9_-]+$/.
    const jobIdSchema = z
      .string()
      .regex(/^[a-zA-Z0-9_-]+$/, 'Invalid job ID format');
  • The serverlessRequest helper function that makes authenticated HTTP requests to the RunPod Serverless runtime API (api.runpod.ai/v2). Used by the retry-job handler to POST to /retry/:jobId.
    async function serverlessRequest(
      endpointId: string,
      path: string,
      method: string = 'GET',
      body?: Record<string, unknown>
    ) {
      const url = `${SERVERLESS_API_BASE_URL}/${endpointId}${path}`;
      const headers: Record<string, string> = {
        Authorization: `Bearer ${API_KEY}`,
        'Content-Type': 'application/json',
      };
    
      const options: NodeFetchRequestInit = {
        method,
        headers,
      };
    
      if (body && (method === 'POST' || method === 'PATCH')) {
        options.body = JSON.stringify(body);
      }
    
      try {
        const response = await fetch(url, options);
    
        if (!response.ok) {
          const errorText = await response.text();
          throw new Error(
            `RunPod Serverless API Error: ${response.status} - ${errorText}`
          );
        }
    
        const contentType = response.headers.get('content-type');
        if (contentType && contentType.includes('application/json')) {
          return await response.json();
        }
    
        return { success: true, status: response.status };
      } catch (error) {
        console.error('Error calling RunPod Serverless API:', error);
        throw error;
      }
    }
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It states 'The previous output is removed and the job is requeued,' which discloses the key behavioral effects. It does not mention permissions or side effects, but the information given is useful and non-contradictory.

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

Conciseness5/5

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

The description is two short sentences with zero wasted words. It is front-loaded with the purpose and efficiently conveys usage and behavior.

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

Completeness4/5

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

For a simple tool with two string parameters and no output schema, the description adequately covers purpose, usage condition, and behavioral effect. It does not discuss error handling or return values, but that is acceptable given the tool's simplicity.

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

Parameters3/5

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

Both parameters have descriptions in the input schema (100% coverage). The description adds no additional meaning beyond what the schema already provides. Therefore, the baseline score of 3 is appropriate.

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

Purpose5/5

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

The description clearly states 'Retry a failed or timed-out Serverless job.' This specifies a verb ('Retry') and a specific resource state ('failed or timed-out job'), distinguishing it from sibling tools like cancel-job or get-job-status.

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

Usage Guidelines4/5

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

The description explicitly says 'Only works for jobs with FAILED or TIMED_OUT status,' providing a clear condition for when to use the tool. It does not mention alternatives or what to do if the job is in a different status, but the condition is sufficient.

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/runpod/runpod-mcp-ts'

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