Skip to main content
Glama
danielbres

massive-mcp

by danielbres

get_last_quote

Retrieve the most recent NBBO bid and ask quote for any stock ticker. Obtain current market data to support trading decisions.

Instructions

Most recent NBBO (bid/ask) quote for a stock.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYesStock symbol (e.g. "AAPL").

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The actual handler function for the get_last_quote tool. It calls the Massive REST API at /v2/last/nbbo/{ticker} to get the most recent NBBO quote for a stock.
    async def get_last_quote(ticker: str) -> dict[str, Any]:
        """Most recent NBBO (bid/ask) quote for a stock.
    
        Args:
            ticker: Stock symbol (e.g. "AAPL").
        """
        return await client.get(f"/v2/last/nbbo/{ticker}")
  • The tool is registered via the @mcp.tool() decorator inside the register() function in quotes.py.
    @mcp.tool()
    async def get_last_quote(ticker: str) -> dict[str, Any]:
        """Most recent NBBO (bid/ask) quote for a stock.
    
        Args:
            ticker: Stock symbol (e.g. "AAPL").
        """
        return await client.get(f"/v2/last/nbbo/{ticker}")
  • The quotes module (containing get_last_quote) is registered via module.register(mcp, client) in server.py's build_server() function.
    for module in (
        aggregates,
        quotes,
        snapshots,
        tickers,
        news,
        reference,
        indicators,
        corporate,
        financials,
    ):
        module.register(mcp, client)
  • MassiveClient.get() is the helper/utility that performs the actual HTTP GET request. get_last_quote calls this with the path /v2/last/nbbo/{ticker}.
    async def get(
        self, path: str, params: dict[str, Any] | None = None, *, trim: bool = True
    ) -> dict[str, Any]:
        merged: dict[str, Any] = {k: v for k, v in (params or {}).items() if v is not None}
        if self._settings.auth_mode == "query":
            merged["apiKey"] = self._settings.api_key
    
        last_exc: Exception | None = None
        for attempt in range(MAX_RETRIES):
            try:
                resp = await self._http.get(path, params=merged)
            except httpx.HTTPError as exc:
                last_exc = exc
                await asyncio.sleep(2**attempt)
                continue
    
            if resp.status_code == 429:
                retry_after = float(resp.headers.get("Retry-After", 2**attempt))
                await asyncio.sleep(min(retry_after, 30))
                continue
            if 500 <= resp.status_code < 600 and attempt < MAX_RETRIES - 1:
                await asyncio.sleep(2**attempt)
                continue
    
            if resp.status_code == 401:
                hint = (
                    "auth rejected — verify MASSIVE_API_KEY; "
                    "if you used MASSIVE_AUTH_MODE=bearer, try 'query' (or vice versa)"
                )
                raise MassiveAPIError(401, hint, _strip_secrets(str(resp.request.url)))
    
            try:
                data = resp.json()
            except ValueError:
                data = {"raw": resp.text}
    
            if not resp.is_success:
                msg = data.get("error") or data.get("message") or resp.reason_phrase or "request failed"
                raise MassiveAPIError(resp.status_code, str(msg), _strip_secrets(str(resp.request.url)))
    
            return _trim(data) if trim else data
    
        raise MassiveAPIError(0, f"network error after {MAX_RETRIES} retries: {last_exc}", path)
Behavior2/5

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

With no annotations, the description bears full responsibility for behavioral disclosure. It only states 'most recent' but does not clarify data freshness (real-time vs. delayed), scope (US equities only?), or potential edge cases (e.g., no quotes for ticker). This is insufficient for a production tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with no wasted words. However, it could be slightly expanded to include usage hints without becoming verbose.

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 output schema exists, the description does not need to detail return values. However, for a tool with many siblings, the description is too minimal; it could mention common use cases or limitations to aid agent selection.

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% coverage, clearly describing the parameter 'ticker' as a stock symbol. The description adds no extra meaning beyond what the schema already provides, so baseline 3 is appropriate.

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 explicitly states the tool returns the most recent NBBO (bid/ask) quote for a stock, which is a specific verb-resource pairing. This clearly distinguishes it from siblings like 'get_last_trade' (trade data) and 'get_quotes' (multiple quotes).

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 is provided on when to use this tool versus alternatives such as 'get_snapshot' or 'get_quotes'. The description lacks context for choosing the right tool among many similar ones.

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/danielbres/Massive-MCP'

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