"""Prompt definitions for Pyth Network MCP Server."""
from mcp.types import Prompt, PromptMessage, GetPromptResult, TextContent
def get_prompt_definitions() -> list[Prompt]:
"""Get all available Pyth Network prompt definitions."""
return [
Prompt(
name="analyze_price_feed",
description="Analyze a cryptocurrency or asset price feed with latest data and trends",
arguments=[
{
"name": "asset_symbol",
"description": "Symbol of the asset to analyze (e.g., BTC, ETH, SOL)",
"required": True
}
]
),
Prompt(
name="compare_prices",
description="Compare multiple asset prices side by side",
arguments=[
{
"name": "symbols",
"description": "Comma-separated list of asset symbols (e.g., BTC,ETH,SOL)",
"required": True
}
]
),
Prompt(
name="market_overview",
description="Get an overview of market data for a specific asset type",
arguments=[
{
"name": "asset_type",
"description": "Asset type: crypto, equity, fx, metal, or rates",
"required": True
}
]
),
Prompt(
name="price_alert_setup",
description="Get instructions to set up price monitoring for an asset",
arguments=[
{
"name": "asset_symbol",
"description": "Symbol of the asset to monitor",
"required": True
}
]
)
]
def handle_get_prompt(name: str, arguments: dict[str, str] | None) -> GetPromptResult:
"""Generate prompt content based on the requested template."""
if name == "analyze_price_feed":
asset_symbol = arguments.get("asset_symbol", "BTC") if arguments else "BTC"
return GetPromptResult(
description=f"Analysis prompt for {asset_symbol}",
messages=[
PromptMessage(
role="user",
content=TextContent(
type="text",
text=f"""Please analyze the {asset_symbol} price feed using the Pyth Network data:
1. First, search for {asset_symbol} price feeds using get_price_feeds tool
2. Get the latest price update for the identified feed ID
3. Calculate the 5-minute TWAP (time-weighted average price)
4. Provide analysis including:
- Current spot price
- 5-minute TWAP comparison
- Confidence interval
- Recent price volatility
- Any notable trends or anomalies
Format the response in a clear, human-readable manner with proper context."""
)
)
]
)
elif name == "compare_prices":
symbols = arguments.get("symbols", "BTC,ETH,SOL") if arguments else "BTC,ETH,SOL"
symbol_list = symbols.split(",")
return GetPromptResult(
description=f"Price comparison for {symbols}",
messages=[
PromptMessage(
role="user",
content=TextContent(
type="text",
text=f"""Compare the prices of these assets: {symbols}
For each asset ({', '.join(symbol_list)}):
1. Search for the price feed using get_price_feeds
2. Get the latest price update
3. Calculate the 5-minute TWAP
Then provide:
- Side-by-side price comparison table
- Percentage differences between assets
- Volatility comparison based on confidence intervals
- Which asset has the most stable pricing
Present the comparison in an easy-to-read format."""
)
)
]
)
elif name == "market_overview":
asset_type = arguments.get("asset_type", "crypto") if arguments else "crypto"
return GetPromptResult(
description=f"Market overview for {asset_type} assets",
messages=[
PromptMessage(
role="user",
content=TextContent(
type="text",
text=f"""Provide a market overview for {asset_type} assets available on Pyth Network:
1. Use get_price_feeds with asset_type="{asset_type}" to list available feeds
2. Select the top 5-10 most important assets in this category
3. Get latest prices for each
4. Present an overview including:
- Total number of {asset_type} feeds available
- List of major assets with current prices
- General market sentiment based on price movements
- Any notable outliers or interesting trends
Format as a comprehensive market report."""
)
)
]
)
elif name == "price_alert_setup":
asset_symbol = arguments.get("asset_symbol", "BTC") if arguments else "BTC"
return GetPromptResult(
description=f"Price monitoring setup for {asset_symbol}",
messages=[
PromptMessage(
role="user",
content=TextContent(
type="text",
text=f"""Help me set up price monitoring for {asset_symbol}:
1. Find the {asset_symbol} price feed ID using get_price_feeds
2. Get the current latest price
3. Provide me with:
- The exact price feed ID to use
- Current price and confidence interval
- Recommended polling interval for this asset
- Code examples for monitoring this feed
- Best practices for setting price alert thresholds
Include practical advice on how to integrate this into an automated system."""
)
)
]
)
else:
raise ValueError(f"Unknown prompt: {name}")