Skip to main content
Glama

set_alert

Create custom alerts to monitor market conditions and receive notifications when specific thresholds are met, such as fear_greed dropping below 20 or risk_score exceeding certain levels.

Instructions

Set custom alerts that trigger when market conditions meet your thresholds. Example: [{field: "fear_greed", operator: "<", threshold: 20, label: "Extreme fear"}]. Call get_alerts to check which are triggered.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
alertsYesArray of alert conditions

Implementation Reference

  • The implementation of the set_alert tool handler, which validates input alert conditions and persists them using setAlerts.
    export function setAlertTool(alerts: SetAlertInput[]): SetAlertResult {
      const validated: AlertCondition[] = [];
    
      for (const a of alerts) {
        if (!VALID_FIELDS.has(a.field)) continue;
        if (!VALID_OPS.has(a.operator)) continue;
    
        validated.push({
          alert_id: generateAlertId(),
          field: a.field,
          operator: a.operator as AlertCondition['operator'],
          threshold: a.threshold,
          label: a.label ?? `${a.field} ${a.operator} ${a.threshold}`,
        });
      }
    
      const stored = setAlerts(AGENT_ID, validated);
    
      return {
        success: true,
        agent_id: AGENT_ID,
        alerts_count: validated.length,
        updated_at: stored.updated_at,
        agent_guidance: `${validated.length} alert${validated.length === 1 ? '' : 's'} configured. Call get_alerts to check which conditions are currently triggered. Alerts are evaluated against live market data on each call.`,
      };
    }
  • Type definitions (schema) for the input and result of the set_alert tool.
    export interface SetAlertInput {
      field: string;
      operator: string;
      threshold: string | number;
      label?: string;
    }
    
    export interface SetAlertResult {
      success: boolean;
      agent_id: string;
      alerts_count: number;
      updated_at: string;
      agent_guidance: string;
    }

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