get-market-info
Retrieve detailed data on a specific prediction market using a market ID or slug. This tool integrates with the PolyMarket API to provide accurate market insights, including pricing and historical trends.
Instructions
Get detailed information about a specific prediction market
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| market_id | Yes | Market ID or slug |
Input Schema (JSON Schema)
{
"properties": {
"market_id": {
"description": "Market ID or slug",
"type": "string"
}
},
"required": [
"market_id"
],
"type": "object"
}
Implementation Reference
- src/polymarket_mcp/server.py:240-247 (handler)Handler implementation for the 'get-market-info' tool. Extracts the market_id argument, fetches market data using the ClobClient, formats it using format_market_info helper, and returns the result as text content.if name == "get-market-info": market_id = arguments.get("market_id") if not market_id: return [types.TextContent(type="text", text="Missing market_id parameter")] market_data = client.get_market(market_id) formatted_info = format_market_info(market_data) return [types.TextContent(type="text", text=formatted_info)]
- src/polymarket_mcp/server.py:47-56 (schema)JSON Schema defining the input for the 'get-market-info' tool, requiring a 'market_id' string parameter.inputSchema={ "type": "object", "properties": { "market_id": { "type": "string", "description": "Market ID or slug", }, }, "required": ["market_id"], },
- src/polymarket_mcp/server.py:44-57 (registration)Registration of the 'get-market-info' tool within the @server.list_tools() handler, specifying name, description, and input schema.types.Tool( name="get-market-info", description="Get detailed information about a specific prediction market", inputSchema={ "type": "object", "properties": { "market_id": { "type": "string", "description": "Market ID or slug", }, }, "required": ["market_id"], }, ),
- src/polymarket_mcp/server.py:121-141 (helper)Helper function that formats the raw market data dictionary into a human-readable string summary, extracting key fields like condition_id, title, status, and resolution_date.def format_market_info(market_data: dict) -> str: """Format market information into a concise string.""" try: if not market_data or not isinstance(market_data, dict): return "No market information available" condition_id = market_data.get('condition_id', 'N/A') title = market_data.get('title', 'N/A') status = market_data.get('status', 'N/A') resolution_date = market_data.get('resolution_date', 'N/A') return ( f"Condition ID: {condition_id}\n" f"Title: {title}\n" f"Status: {status}\n" f"Resolution Date: {resolution_date}\n" "---" ) except Exception as e: return f"Error formatting market data: {str(e)}"