Skip to main content
Glama
pythia-the-oracle

pythia-oracle-mcp

Official

subscribe_info

Plan a subscription to monitor a feed with condition and duration, returning cost and exact calls.

Instructions

Plan a specific Pythia Events subscription with cost and exact calls.

Args: feed_name: Feed name to monitor (e.g. 'pol_RSI_5M_14', 'bitcoin_EMA_1H_20') condition: 0=ABOVE, 1=BELOW, 2=CROSSES_ABOVE, 3=CROSSES_BELOW days: Subscription duration in days (1-365)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
feed_nameYes
conditionNo
daysNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Tool 'subscribe_info' is registered via @mcp.tool() decorator on line 791. It is defined as an async function that plans a Pythia Events subscription with cost and exact calls.
    @mcp.tool()
    async def subscribe_info(
        feed_name: str,
        condition: int = 1,
        days: int = 7,
    ) -> str:
        """Plan a specific Pythia Events subscription with cost and exact calls.
    
        Args:
            feed_name: Feed name to monitor (e.g. 'pol_RSI_5M_14', 'bitcoin_EMA_1H_20')
            condition: 0=ABOVE, 1=BELOW, 2=CROSSES_ABOVE, 3=CROSSES_BELOW
            days: Subscription duration in days (1-365)
        """
        if condition < 0 or condition > 3:
            return "Invalid condition. Use: 0=ABOVE, 1=BELOW, 2=CROSSES_ABOVE, 3=CROSSES_BELOW"
        if days < 1 or days > 365:
            return "Days must be 1-365."
    
        data = await _fetch_data()
        events = data.get("events", {}) if data else {}
        mainnet = _get_mainnet(data)
        registries = events.get("registries", [])
        cond_name = _CONDITION_NAMES.get(condition, "UNKNOWN")
    
        lines = [f"Pythia Events — Subscription Plan\n"]
        lines.append(f"  Feed:      {feed_name}")
        lines.append(f"  Condition: {cond_name} ({condition})")
        lines.append(f"  Duration:  {days} days")
        lines.append(f"  Cost:      {days} LINK ({events.get('pricing', '1 LINK/day')})")
    
        if condition >= 2:
            lines.append(f"\n  WARNING: {cond_name} is accepted but not yet processed.")
            lines.append("  Subscription will be stored; it fires when condition is activated.")
    
        lines.append(f"\n  Threshold: YOU MUST SET THIS — scaled to 8 decimals.")
        lines.append("  Examples:")
        lines.append("    RSI 30      → 3000000000")
        lines.append("    RSI 70      → 7000000000")
        lines.append("    EMA $2500   → 250000000000  (2500 * 1e8)")
        lines.append("    Vol 5%      → 500000000     (0.05 * 1e8)")
    
        lines.append("\nExact Calls (from your contract or EOA):\n")
        lines.append("  // Step 1: Approve LINK spending")
        lines.append(f'  LINK.approve(registry, {days} * 1e18);')
        lines.append("")
        lines.append("  // Step 2: Subscribe")
        lines.append(f'  uint256 eventId = registry.subscribe(')
        lines.append(f'      "{feed_name}",')
        lines.append(f"      {days},          // numDays")
        lines.append(f"      {condition},          // {cond_name}")
        lines.append(f"      YOUR_THRESHOLD  // 8 decimal places")
        lines.append(f"  );")
        lines.append("")
        lines.append("  // Step 3: Listen for the alert")
        lines.append("  // Off-chain: registry.on('PythiaEvent', (eventId, value) => { ... })")
    
        if registries:
            lines.append("\nRegistry Addresses:")
            for reg in registries:
                lines.append(f"  {reg['chain']}: {reg['address']}")
    
        lines.append(f"\nLINK Token (mainnet): {mainnet['link_token']}")
        lines.append(f"Refund: {events.get('refund', 'unused whole days refunded')}")
        lines.append(f"\nUse get_events_guide() for a complete Solidity contract.")
        return "\n".join(lines)
  • Handler function for 'subscribe_info' tool. Takes feed_name, condition (0-3), and days (1-365) as input, validates them, fetches live data, and returns a formatted subscription plan with cost, condition info, threshold examples, and exact Solidity calls for approval and subscription.
    async def subscribe_info(
        feed_name: str,
        condition: int = 1,
        days: int = 7,
    ) -> str:
        """Plan a specific Pythia Events subscription with cost and exact calls.
    
        Args:
            feed_name: Feed name to monitor (e.g. 'pol_RSI_5M_14', 'bitcoin_EMA_1H_20')
            condition: 0=ABOVE, 1=BELOW, 2=CROSSES_ABOVE, 3=CROSSES_BELOW
            days: Subscription duration in days (1-365)
        """
        if condition < 0 or condition > 3:
            return "Invalid condition. Use: 0=ABOVE, 1=BELOW, 2=CROSSES_ABOVE, 3=CROSSES_BELOW"
        if days < 1 or days > 365:
            return "Days must be 1-365."
    
        data = await _fetch_data()
        events = data.get("events", {}) if data else {}
        mainnet = _get_mainnet(data)
        registries = events.get("registries", [])
        cond_name = _CONDITION_NAMES.get(condition, "UNKNOWN")
    
        lines = [f"Pythia Events — Subscription Plan\n"]
        lines.append(f"  Feed:      {feed_name}")
        lines.append(f"  Condition: {cond_name} ({condition})")
        lines.append(f"  Duration:  {days} days")
        lines.append(f"  Cost:      {days} LINK ({events.get('pricing', '1 LINK/day')})")
    
        if condition >= 2:
            lines.append(f"\n  WARNING: {cond_name} is accepted but not yet processed.")
            lines.append("  Subscription will be stored; it fires when condition is activated.")
    
        lines.append(f"\n  Threshold: YOU MUST SET THIS — scaled to 8 decimals.")
        lines.append("  Examples:")
        lines.append("    RSI 30      → 3000000000")
        lines.append("    RSI 70      → 7000000000")
        lines.append("    EMA $2500   → 250000000000  (2500 * 1e8)")
        lines.append("    Vol 5%      → 500000000     (0.05 * 1e8)")
    
        lines.append("\nExact Calls (from your contract or EOA):\n")
        lines.append("  // Step 1: Approve LINK spending")
        lines.append(f'  LINK.approve(registry, {days} * 1e18);')
        lines.append("")
        lines.append("  // Step 2: Subscribe")
        lines.append(f'  uint256 eventId = registry.subscribe(')
        lines.append(f'      "{feed_name}",')
        lines.append(f"      {days},          // numDays")
        lines.append(f"      {condition},          // {cond_name}")
        lines.append(f"      YOUR_THRESHOLD  // 8 decimal places")
        lines.append(f"  );")
        lines.append("")
        lines.append("  // Step 3: Listen for the alert")
        lines.append("  // Off-chain: registry.on('PythiaEvent', (eventId, value) => { ... })")
    
        if registries:
            lines.append("\nRegistry Addresses:")
            for reg in registries:
                lines.append(f"  {reg['chain']}: {reg['address']}")
    
        lines.append(f"\nLINK Token (mainnet): {mainnet['link_token']}")
        lines.append(f"Refund: {events.get('refund', 'unused whole days refunded')}")
        lines.append(f"\nUse get_events_guide() for a complete Solidity contract.")
        return "\n".join(lines)
  • _CONDITION_NAMES dict maps integer condition codes (0=ABOVE, 1=BELOW, 2=CROSSES_ABOVE, 3=CROSSES_BELOW) to human-readable names, used by subscribe_info to display the condition name.
    _CONDITION_NAMES = {0: "ABOVE", 1: "BELOW", 2: "CROSSES_ABOVE", 3: "CROSSES_BELOW"}
Behavior2/5

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

No annotations provided, so the description carries full burden. It uses the verb 'Plan', implying a read-only preview, but does not explicitly state that no subscription is created or that it requires authentication. The behavioral traits (side effects, needed permissions) are unclear.

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 very concise: one sentence stating purpose plus a bulleted parameter list. Every element is informative and none are redundant. The purpose is front-loaded, making it quick for the agent to grasp.

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 the 16 sibling tools and that an output schema exists, the description leaves out broader workflow context (e.g., that this is for planning before using a subscribe action, or relationship to pricing). While parameters are well-covered, the tool's role within the ecosystem is not explained.

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

Parameters5/5

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

With 0% schema coverage, the description fully compensates by explaining each parameter beyond the schema. It provides feed_name examples ('pol_RSI_5M_14'), a complete condition mapping (0=ABOVE, 1=BELOW, 2=CROSSES_ABOVE, 3=CROSSES_BELOW), and days range (1-365). This adds significant value for correct invocation.

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 it plans a subscription with cost and exact calls, using a specific verb ('Plan') and resource ('Pythia Events subscription'). It distinguishes from siblings like 'list_subscriptions' (listing existing) and 'get_events_info' (getting event info) by focusing on planning before subscribing.

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

Usage Guidelines2/5

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

No guidance on when to use this tool versus alternatives. Siblings like 'list_subscriptions' and 'get_pricing' exist but no explicit when-to-use or when-not-to-use context is provided. The description assumes the agent knows the workflow.

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/pythia-the-oracle/pythia-oracle-mcp'

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