Skip to main content
Glama
kukapay

crypto-stocks-mcp

get_stock_price

Retrieve real-time stock prices for crypto-related companies by entering a ticker symbol. Returns current price, company name, and timestamp in a formatted table.

Instructions

Get real-time price for a specific stock in a table format.

Args:
    ticker (str): The stock ticker symbol (e.g., 'COIN' for Coinbase).

Returns:
    str: An ASCII table string containing the ticker, company name, current price, and timestamp.
         Returns an error message if the ticker is invalid.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:51-73 (handler)
    The handler function for the 'get_stock_price' tool. It checks if the ticker is valid using CRYPTO_STOCKS, fetches the current price using yfinance.Ticker, and formats the result as an ASCII table with ticker, name, price, and timestamp.
    def get_stock_price(ticker: str) -> str:
        """Get real-time price for a specific stock in a table format.
    
        Args:
            ticker (str): The stock ticker symbol (e.g., 'COIN' for Coinbase).
    
        Returns:
            str: An ASCII table string containing the ticker, company name, current price, and timestamp.
                 Returns an error message if the ticker is invalid.
        """
        if ticker not in CRYPTO_STOCKS:
            return f"Error: Unknown ticker {ticker}"
        
        stock = yf.Ticker(ticker)
        price = stock.info.get("regularMarketPrice", "N/A")
        table_data = [[ticker, CRYPTO_STOCKS[ticker], price, datetime.now().isoformat()]]
        return tabulate(
            table_data,
            headers=["Ticker", "Name", "Price", "Timestamp"],
            tablefmt="grid",
            stralign="left",
            floatfmt=".2f"
        )
  • main.py:10-27 (helper)
    Dictionary of supported crypto-related stock tickers and their full names, used by get_stock_price to validate tickers and provide company names.
    CRYPTO_STOCKS = {
      "BMNR": "BitMine Immersion Technologies, Inc.",
      "CRCL": "Circle Internet Group Inc.",
      "SBET": "SharpLink Gaming Inc.",  
      "SRM": "Tron Inc.",
      "DFDV": "DeFi Development Corp.",
      "MSTR": "MicroStrategy Incorporated",
      "COIN": "Coinbase Global Inc.",
      "MARA": "Marathon Digital Holdings",
      "RIOT": "Riot Platforms Inc.",
      "HIVE": "HIVE Digital Technologies",
      "CORZ": "Core Scientific Inc.",
      "IREN": "Iris Energy Limited",
      "CLSK": "CleanSpark Inc.",
      "HUT": "Hut 8 Corp",
      "CIFR": "Cipher Mining Inc.",
      "BITF": "Bitfarms Ltd"
    }
  • main.py:51-51 (registration)
    The @mcp.tool() decorator registers the get_stock_price function as an MCP tool.
    def get_stock_price(ticker: str) -> str:
  • main.py:52-60 (schema)
    Type hints and docstring defining the input schema (ticker: str) and output (str table or error).
    """Get real-time price for a specific stock in a table format.
    
    Args:
        ticker (str): The stock ticker symbol (e.g., 'COIN' for Coinbase).
    
    Returns:
        str: An ASCII table string containing the ticker, company name, current price, and timestamp.
             Returns an error message if the ticker is invalid.
    """
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: the tool returns data in an ASCII table format, includes specific fields (ticker, company name, current price, timestamp), and handles errors for invalid tickers. However, it lacks details on rate limits, authentication needs, or data sources, which are relevant for a real-time financial tool.

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 well-structured and front-loaded with the core purpose, followed by clear sections for Args and Returns. Every sentence adds value: the first states what the tool does, the second explains the parameter, and the third details the return format and error handling. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/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 (1 parameter, no nested objects) and the presence of an output schema (implied by the Returns section), the description is mostly complete. It covers the purpose, parameter meaning, and return format. However, for a real-time financial tool, additional context like data freshness or limitations would enhance completeness, but the output schema reduces the need for return value explanations.

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

Parameters4/5

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

The schema description coverage is 0%, so the description must compensate. It adds meaningful semantics by explaining the 'ticker' parameter as a stock ticker symbol with an example ('COIN' for Coinbase), which clarifies usage beyond the bare schema. Since there's only one parameter, this is sufficient for a high score, though it doesn't cover edge cases like formatting requirements.

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 the specific action ('Get real-time price'), the resource ('specific stock'), and the output format ('in a table format'). It distinguishes from sibling tools like 'get_historical_prices' by specifying 'real-time' and from 'get_stock_list' by focusing on a single stock rather than a list.

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

Usage Guidelines4/5

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

The description implies usage context by specifying 'real-time' price, suggesting it's for current data rather than historical (contrasting with 'get_historical_prices'). However, it doesn't explicitly state when NOT to use this tool or name alternatives, leaving some guidance implicit rather than explicit.

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/kukapay/crypto-stocks-mcp'

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