get_daily_market_summary
Retrieve open, high, low, close (OHLC) data for the entire US stock market on a specified trading date, with optional adjustment for stock splits.
Instructions
OHLC for the entire US stock market on a given trading date.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | Yes | "YYYY-MM-DD". | |
| adjusted | No | Adjust for splits. Default true. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler: an MCP tool decorated with @mcp.tool(). Calls the Massive API endpoint /v2/aggs/grouped/locale/us/market/stocks/{date} to return OHLC data for the entire US stock market on a given date.
@mcp.tool() async def get_daily_market_summary(date: str, adjusted: bool = True) -> dict[str, Any]: """OHLC for the entire US stock market on a given trading date. Args: date: "YYYY-MM-DD". adjusted: Adjust for splits. Default true. """ return await client.get( f"/v2/aggs/grouped/locale/us/market/stocks/{date}", {"adjusted": str(adjusted).lower()}, ) - src/massive_mcp/tools/aggregates.py:12-13 (registration)Registration mechanism: the module exposes a register() function which is called from server.py line 48 (module.register(mcp, client)). The @mcp.tool() decorator registers the handler with the FastMCP server.
def register(mcp: FastMCP, client: MassiveClient) -> None: @mcp.tool() - src/massive_mcp/server.py:37-48 (registration)Server registration: loops through tool modules and calls their register() function to register all tools, including get_daily_market_summary from aggregates.py.
for module in ( aggregates, quotes, snapshots, tickers, news, reference, indicators, corporate, financials, ): module.register(mcp, client) - src/massive_mcp/client.py:47-89 (helper)The HTTP client helper that performs the actual GET request with retry logic, error handling, and response trimming. Used by the get_daily_market_summary handler to call the Massive API.
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)