Skip to main content
Glama
Hookflo
by Hookflo

manage_dlq

List or replay failed webhook events in Tern's dead letter queue to handle delivery issues and retry specific events.

Instructions

Manage your Tern dead letter queue — list all failed webhook events or replay a specific failed event. Powered by Upstash QStash.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYeslist — show all failed events, replay — retry a specific event
qstashTokenYesUpstash QStash token — use process.env.QSTASH_TOKEN
dlqIdNoDLQ event ID — required for replay action

Implementation Reference

  • The handler function `manageDlq` processes the 'list' and 'replay' actions for managing the Upstash QStash dead letter queue.
    export async function manageDlq(input: ManageDlqInput) {
      const controls = createTernControls({
        token: input.qstashToken,
      })
    
      if (input.action === 'list') {
        try {
          const failed = await controls.dlq()
          if (!failed.length) {
            return {
              action: 'list',
              count: 0,
              message: '✓ Dead letter queue is empty. No failed events.',
              events: [],
            }
          }
    
          return {
            action: 'list',
            count: failed.length,
            message: `${failed.length} failed event${failed.length === 1 ? '' : 's'} in dead letter queue`,
            events: failed.map((event: any) => ({
              dlqId: event.dlqId,
              messageId: event.messageId,
              url: event.url,
              createdAt: event.createdAt,
              responseStatus: event.responseStatus,
              responseBody: event.responseBody,
              retried: event.retried,
            })),
            nextStep: 'Use action: replay with a dlqId to replay a specific event',
          }
        } catch (error) {
          return {
            action: 'list',
            error: (error as Error).message,
            tip: 'Check your QSTASH_TOKEN is correct and Upstash account is active',
          }
        }
      }
    
      if (input.action === 'replay') {
        if (!input.dlqId) {
          return {
            action: 'replay',
            error: 'dlqId is required for replay action',
            tip: 'Run list action first to get the dlqId of the event you want to replay',
          }
        }
    
        try {
          const result = await controls.replay(input.dlqId)
          return {
            action: 'replay',
            success: true,
            dlqId: input.dlqId,
            message: `✓ Event ${input.dlqId} replayed successfully`,
            result,
          }
        } catch (error) {
          return {
            action: 'replay',
            success: false,
            dlqId: input.dlqId,
            error: (error as Error).message,
            tip: 'Check the dlqId is correct and the event still exists in the DLQ',
          }
        }
      }
    
      return {
        action: input.action,
        error: 'Unsupported action',
      }
    }
  • Zod schema defining the input requirements for the `manage_dlq` tool.
    export const manageDlqSchema = z.object({
      action: z.enum(['list', 'replay'])
        .describe('Action to perform: list DLQ events or replay a failed event'),
      qstashToken: z.string()
        .describe('Your Upstash QStash token from environment'),
      dlqId: z.string()
        .optional()
        .describe('DLQ event ID to replay — required for replay action'),
    })
  • src/index.ts:78-89 (registration)
    Tool registration in the MCP server's `ListToolsRequestSchema` handler.
      name: 'manage_dlq',
      description: 'Manage your Tern dead letter queue — list all failed webhook events or replay a specific failed event. Powered by Upstash QStash.',
      inputSchema: {
        type: 'object',
        properties: {
          action: { type: 'string', enum: ['list', 'replay'], description: 'list — show all failed events, replay — retry a specific event' },
          qstashToken: { type: 'string', description: 'Upstash QStash token — use process.env.QSTASH_TOKEN' },
          dlqId: { type: 'string', description: 'DLQ event ID — required for replay action' },
        },
        required: ['action', 'qstashToken'],
      },
    },
  • Tool execution logic in the MCP server's `CallToolRequestSchema` handler, where the `manage_dlq` tool is called.
    } else if (name === 'manage_dlq') {
      const input = manageDlqSchema.parse(args)
      result = await manageDlq(input)
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the two main behaviors (listing and replaying) but lacks details on permissions, rate limits, side effects of replaying, or what 'replay' entails. The mention of 'Upstash QStash' adds some context but isn't detailed.

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 front-loaded with the core purpose in one efficient sentence, followed by a brief context note. Every sentence adds value without redundancy, making it appropriately sized and well-structured.

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

Completeness3/5

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

Given no annotations and no output schema, the description is moderately complete for a tool with 3 parameters and clear actions. It covers what the tool does but lacks details on behavioral traits, error handling, or output format, leaving gaps for an agent to understand full usage.

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 description coverage is 100%, so the schema fully documents parameters. The description adds no additional parameter semantics beyond what's in the schema, but with high coverage, the baseline is 3. It gets a 4 because it implicitly reinforces the action parameter's meaning by listing the two options in the description.

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 the tool's purpose with specific verbs ('list' and 'replay') and resource ('dead letter queue'), and distinguishes it from sibling tools by specifying it's for managing failed webhook events, which none of the siblings address.

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 implies when to use it (for failed webhook events) but doesn't provide explicit guidance on when to choose this tool over alternatives or prerequisites. It mentions 'Powered by Upstash QStash' which hints at context but isn't a clear usage directive.

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/Hookflo/tern-mcp'

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