Skip to main content
Glama

set_webhook

Configure automated alerts by setting conditions on financial metrics. Receive POST notifications to your URL when market criteria are met, enabling timely response to changing conditions.

Instructions

Register a webhook that fires when market conditions meet your criteria. Fathom evaluates conditions every 60 seconds and POSTs a JSON payload to your URL when all conditions are met. Example: alert me at my bot URL when fear_greed < 20 and regime == capitulation. Available fields: fear_greed, risk_score, opportunity_score, regime, posture, cycle_phase, tvl_change_7d, defi_health, macro_impact, net_flow_signal, leverage_signal, btc_put_call, btc_sp500_correlation, macro_risk_appetite.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesHTTPS URL to POST webhook payload to
conditionsYesConditions that must ALL be true to trigger
labelNoHuman-readable label for this webhook
cooldown_minutesNoMinimum minutes between triggers (default: 60)

Implementation Reference

  • The 'set_webhook' MCP tool is registered and implemented in src/index.ts. It validates inputs via Zod, performs access control, and calls the 'registerWebhook' helper function.
    // ─── Tool: set_webhook ───
    server.tool(
      'set_webhook',
      'Register a webhook that fires when market conditions meet your criteria. Fathom evaluates conditions every 60 seconds and POSTs a JSON payload to your URL when all conditions are met. Example: alert me at my bot URL when fear_greed < 20 and regime == capitulation. Available fields: fear_greed, risk_score, opportunity_score, regime, posture, cycle_phase, tvl_change_7d, defi_health, macro_impact, net_flow_signal, leverage_signal, btc_put_call, btc_sp500_correlation, macro_risk_appetite.',
      {
        url: z.string().url().describe('HTTPS URL to POST webhook payload to'),
        conditions: z.array(z.object({
          field: z.string().describe('Condition field (fear_greed, risk_score, regime, posture, net_flow_signal, leverage_signal, etc.)'),
          operator: z.enum(['<', '>', '<=', '>=', '==', '!=']).describe('Comparison operator'),
          threshold: z.union([z.string(), z.number()]).describe('Threshold value'),
        })).min(1).describe('Conditions that must ALL be true to trigger'),
        label: z.string().optional().describe('Human-readable label for this webhook'),
        cooldown_minutes: z.number().optional().describe('Minimum minutes between triggers (default: 60)'),
      },
      async ({ url, conditions, label, cooldown_minutes }) => {
        const gateError = gateTool('set_webhook');
        if (gateError) return { content: [{ type: 'text' as const, text: gateError }] };
    
        const webhook = await registerWebhook({
          url,
          conditions: conditions as { field: string; operator: '<' | '>' | '<=' | '>=' | '==' | '!='; threshold: string | number }[],
          label,
          cooldown_minutes: cooldown_minutes ?? 60,
        });
    
        return { content: [{ type: 'text' as const, text: JSON.stringify({
          status: 'registered',
          webhook_id: webhook.id,
          url: webhook.url,
          conditions: webhook.conditions,
          label: webhook.label,
          cooldown_minutes: webhook.cooldown_minutes,
          agent_guidance: `Webhook registered. Fathom will POST to ${webhook.url} when all conditions are met. Conditions are evaluated every 60 seconds. Cooldown: ${webhook.cooldown_minutes} minutes between triggers. Use manage_webhooks to list or remove webhooks.`,
        }, null, 2) }] };
      },
    );
Behavior4/5

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

No annotations provided, so description carries full disclosure burden. Successfully reveals polling frequency (60s), conjunction logic (ALL conditions), and payload format (JSON). Missing webhook lifecycle details (expiration, persistence) and error handling behavior (retries, timeout).

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?

Four logical segments: purpose declaration, behavioral details, concrete example, field reference. Every sentence earns its place. Front-loaded with essential mechanism details before moving to reference data. No redundant or tautological language.

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?

Given 100% schema coverage and no output schema, description appropriately compensates by explaining the trigger evaluation logic and field semantics. Minor gap: does not indicate what successful registration returns (webhook ID?) or management lifecycle, which would help for a stateful configuration tool.

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%, establishing baseline 3. Description adds significant value by enumerating complete available field list (expanding on schema's 'etc.'), and providing concrete syntax example showing operators and thresholds in context.

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?

Excellent clarity: 'Register a webhook' provides specific verb and resource. Expands to explain trigger mechanism (market conditions), execution frequency (60 seconds), and payload format (JSON POST). Clearly distinguishes from passive data retrieval tools in sibling list.

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?

Provides concrete usage example ('alert me at my bot URL when fear_greed < 20...') illustrating the condition syntax. However, lacks explicit guidance on when to use this versus set_alert or manage_webhooks siblings, or prerequisites like URL accessibility requirements.

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

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