Skip to main content
Glama
berlinbra

PolyMarket MCP Server

get-market-prices

Retrieve real-time prices and trading details for specific markets using market ID or slug. Integrates with the PolyMarket API to provide accurate prediction market data for analysis.

Instructions

Get current prices and trading information for a market

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
market_idYesMarket ID or slug

Implementation Reference

  • Handler for the get-market-prices tool: extracts market_id argument, fetches market data using ClobClient.get_market(), formats it with format_market_prices(), and returns as TextContent.
    elif name == "get-market-prices":
        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_prices = format_market_prices(market_data)
        return [types.TextContent(type="text", text=formatted_prices)]
  • Tool registration in list_tools(): defines name, description, and input schema requiring 'market_id'.
    types.Tool(
        name="get-market-prices",
        description="Get current prices and trading information for a market",
        inputSchema={
            "type": "object",
            "properties": {
                "market_id": {
                    "type": "string",
                    "description": "Market ID or slug",
                },
            },
            "required": ["market_id"],
        },
    ),
  • JSON schema for get-market-prices input: object with required 'market_id' string.
        "type": "object",
        "properties": {
            "market_id": {
                "type": "string",
                "description": "Market ID or slug",
            },
        },
        "required": ["market_id"],
    },
  • Helper function to format market data into a readable string, extracting title and current_price.
    def format_market_prices(market_data: dict) -> str:
        """Format market prices into a concise string."""
        try:
            if not market_data or not isinstance(market_data, dict):
                return market_data
                
            formatted_prices = [
                f"Current Market Prices for {market_data.get('title', 'Unknown Market')}\n"
            ]
            
            # Extract price information from market data
            # Note: Adjust this based on actual CLOB client response structure
            current_price = market_data.get('current_price', 'N/A')
            formatted_prices.append(
                f"Current Price: {current_price}\n"
                "---\n"
            )
            
            return "\n".join(formatted_prices)
        except Exception as e:
            return f"Error formatting price data: {str(e)}"
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves 'current prices and trading information', implying a read-only operation, but doesn't specify aspects like rate limits, authentication needs, data freshness, or error handling. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 a single, efficient sentence that directly states the tool's purpose without any wasted words. It is front-loaded with the core functionality, making it easy to parse and understand quickly.

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 tool's low complexity (one parameter, no output schema, no annotations), the description is adequate but has clear gaps. It covers the basic purpose but lacks usage guidelines and behavioral details, making it incomplete for optimal agent decision-making in a context with sibling tools.

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

Parameters3/5

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

The input schema has 100% description coverage, with the 'market_id' parameter clearly documented as 'Market ID or slug'. The description adds no additional meaning beyond this, such as examples or format details, but since the schema does the heavy lifting, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('current prices and trading information for a market'), making it easy to understand what it does. However, it doesn't explicitly differentiate itself from sibling tools like 'get-market-info' or 'get-market-history', which might also retrieve market-related data, so it doesn't reach the highest score.

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?

The description provides no guidance on when to use this tool versus alternatives like 'get-market-info' or 'get-market-history'. It lacks context about specific use cases, prerequisites, or exclusions, leaving the agent to infer usage based on tool names alone.

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

Related 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/berlinbra/polymarket-mcp'

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