Skip to main content
Glama

manage_webhooks

List or remove webhooks in the Fathom-fyi MCP server to monitor financial data triggers and manage notification endpoints.

Instructions

List all registered webhooks or remove one by ID. Use action "list" to see all webhooks with their conditions, trigger counts, and last triggered time. Use action "remove" with a webhook_id to delete a webhook.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes"list" to see all webhooks, "remove" to delete one
webhook_idNoWebhook ID to remove (required for action "remove")

Implementation Reference

  • Handler function for 'manage_webhooks' tool, which handles 'list' and 'remove' actions.
    async ({ action, webhook_id }) => {
      const gateError = gateTool('manage_webhooks');
      if (gateError) return { content: [{ type: 'text' as const, text: gateError }] };
    
      if (action === 'list') {
        const hooks = await listWebhooks();
        return { content: [{ type: 'text' as const, text: JSON.stringify({
          webhooks: hooks.map(h => ({
            id: h.id,
            url: h.url,
            label: h.label,
            conditions: h.conditions,
            cooldown_minutes: h.cooldown_minutes,
            trigger_count: h.trigger_count,
            last_triggered: h.last_triggered ?? 'never',
            created_at: h.created_at,
          })),
          count: hooks.length,
          agent_guidance: hooks.length === 0
            ? 'No webhooks registered. Use set_webhook to create one.'
            : `${hooks.length} webhook(s) active. Total triggers: ${hooks.reduce((s, h) => s + h.trigger_count, 0)}.`,
        }, null, 2) }] };
      }
    
      if (action === 'remove') {
        if (!webhook_id) {
          return { content: [{ type: 'text' as const, text: JSON.stringify({ error: 'webhook_id is required for remove action' }) }] };
        }
        const removed = await removeWebhook(webhook_id);
        return { content: [{ type: 'text' as const, text: JSON.stringify({
          status: removed ? 'removed' : 'not_found',
          webhook_id,
          agent_guidance: removed ? 'Webhook removed. It will no longer fire.' : 'Webhook ID not found. Use manage_webhooks with action "list" to see active webhooks.',
        }, null, 2) }] };
      }
    
      return { content: [{ type: 'text' as const, text: '{"error": "Invalid action"}' }] };
    },
  • src/index.ts:482-527 (registration)
    Registration of the 'manage_webhooks' tool with schema and description.
    server.tool(
      'manage_webhooks',
      'List all registered webhooks or remove one by ID. Use action "list" to see all webhooks with their conditions, trigger counts, and last triggered time. Use action "remove" with a webhook_id to delete a webhook.',
      {
        action: z.enum(['list', 'remove']).describe('"list" to see all webhooks, "remove" to delete one'),
        webhook_id: z.string().optional().describe('Webhook ID to remove (required for action "remove")'),
      },
      async ({ action, webhook_id }) => {
        const gateError = gateTool('manage_webhooks');
        if (gateError) return { content: [{ type: 'text' as const, text: gateError }] };
    
        if (action === 'list') {
          const hooks = await listWebhooks();
          return { content: [{ type: 'text' as const, text: JSON.stringify({
            webhooks: hooks.map(h => ({
              id: h.id,
              url: h.url,
              label: h.label,
              conditions: h.conditions,
              cooldown_minutes: h.cooldown_minutes,
              trigger_count: h.trigger_count,
              last_triggered: h.last_triggered ?? 'never',
              created_at: h.created_at,
            })),
            count: hooks.length,
            agent_guidance: hooks.length === 0
              ? 'No webhooks registered. Use set_webhook to create one.'
              : `${hooks.length} webhook(s) active. Total triggers: ${hooks.reduce((s, h) => s + h.trigger_count, 0)}.`,
          }, null, 2) }] };
        }
    
        if (action === 'remove') {
          if (!webhook_id) {
            return { content: [{ type: 'text' as const, text: JSON.stringify({ error: 'webhook_id is required for remove action' }) }] };
          }
          const removed = await removeWebhook(webhook_id);
          return { content: [{ type: 'text' as const, text: JSON.stringify({
            status: removed ? 'removed' : 'not_found',
            webhook_id,
            agent_guidance: removed ? 'Webhook removed. It will no longer fire.' : 'Webhook ID not found. Use manage_webhooks with action "list" to see active webhooks.',
          }, null, 2) }] };
        }
    
        return { content: [{ type: 'text' as const, text: '{"error": "Invalid action"}' }] };
      },
    );
  • Backend helpers 'listWebhooks' and 'removeWebhook' used by the tool handler.
    export async function removeWebhook(id: string): Promise<boolean> {
      await loadWebhooks();
      const removed = webhooks.delete(id);
      if (removed) await saveWebhooks();
      return removed;
    }
    
    export async function listWebhooks(): Promise<WebhookConfig[]> {
      await loadWebhooks();
      return Array.from(webhooks.values());
    }

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/0xHashy/fathom-fyi'

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