Skip to content
Live news Screener Coverage Pricing Docs REST API WebSocket API MCP server Company Use cases Blog Changelog Status Compare Contact
BLK$1,118.50-18.79(-1.65%)BlackRock® Canada Announces the Termination of iShares Convertible Bond Index ETF[5:23:34 PM ET]ITFS$1.43-0.02(-1.10%)Itafos Announces Release Date for Q3 2026 Results and Business Update Webcast[5:15:00 PM ET]FAGI$0.01-0.00(-13.33%)Full Alliance Group, Inc (OTC:FAGI) YAHBEE Highlights Community-Commerce Model for Agentic Commerce Era[5:15:00 PM ET]TGT$152.76-5.35(-3.38%)Vital Farms Introduces a Higher Standard for Free-Range Eggs Through Limited Pilot at Select Target Retail Stores[5:05:00 PM ET]NU$15.27+0.54(+3.67%)Notice to Market: Nu Holdings Ltd.[5:03:00 PM ET]POR$44.55-0.35(-0.78%)Portland General Electric Declares Dividend[5:00:00 PM ET]ANTX$3.55-0.09(-2.47%)AN2 Therapeutics, Inc. Reports Inducement Grants Under Listing Rule 5635(c)(4)[5:00:00 PM ET]EML$24.18-0.67(-2.70%)The Eastern Company Announces Timing of Third Quarter 2026 Earnings Release and Conference Call[4:55:00 PM ET]MYE$32.13-0.70(-2.13%)Myers Industries Announces Quarterly Dividend[4:45:00 PM ET]FCAP$63.35-0.59(-0.92%)First Capital, Inc. Reports Quarterly Earnings[4:45:00 PM ET]AIRDF$0.33-0.01(-3.96%)Rocket Doctor Grants Equity[4:42:20 PM ET]OXSQ$1.31-0.02(-1.83%)Oxford Square Capital Corp. Schedules Third Quarter 2026 Earnings Release and Conference Call for October 30, 2026[4:37:45 PM ET]SMMT$15.550.00(0.00%)Summit Therapeutics and Lunit Announce Agreement to Apply AI-powered SCOPE IO Platform for Tumor Microenvironment Analysis in Immuno-Oncology Development[4:37:00 PM ET]DGX$241.89-1.39(-0.57%)PRIVACY ALERT: AWKO Law LLP Investigates Quest Diagnostics for Data Breach of Patient Records[4:33:00 PM ET]
Guide 7 min read

Give your AI agent real-time market news (tool calling + RAG)

How to connect an LLM agent to live financial news: a tool definition for /v1/news, prompt patterns, and why short summaries beat raw articles in context.

Large language models don't know what happened in the market this morning. Their training data stops months ago, and web search results are noisy and slow. A news API gives an agent a clean, current, symbol-tagged view of the market it can query in one tool call.

Why structured news beats web search for agents

  • Precision: filter by tickers=NVDA instead of hoping a search engine ranks the right pages.
  • Freshness: sources are polled every second, and each article has exact timestamps.
  • Token budget: a 2-sentence summary plus title is roughly 60 tokens. A scraped article can be 2,000.
  • Grounding: every item has a source and URL the model can cite.

1. Define the tool

Expose a narrow tool. Agents do better with a few clear parameters than with every filter we support.

tool definition
{
  "type": "function",
  "function": {
    "name": "get_market_news",
    "description": "Get recent stock news. Use for questions about why a stock moved, or what's happening with a company.",
    "parameters": {
      "type": "object",
      "properties": {
        "tickers": {
          "type": "string",
          "description": "Comma-separated stock tickers, e.g. 'AAPL,MSFT'"
        },
        "category": {
          "type": "string",
          "enum": [
            "stocks"
          ],
          "description": "stocks"
        },
        "q": {
          "type": "string",
          "description": "Optional keyword or phrase"
        },
        "hours": {
          "type": "integer",
          "description": "Look-back window in hours (default 24)"
        }
      }
    }
  }
}

2. Implement it

Return compact records. Drop fields the model doesn't need, and keep the URL for citations.

import os
from datetime import datetime, timedelta, timezone

import requests


def get_market_news(tickers=None, category="stocks", q=None, hours=24):
    params = {"limit": 15, "from": (datetime.now(timezone.utc) - timedelta(hours=hours)).isoformat()}
    for k, v in {"tickers": tickers, "category": category, "q": q}.items():
        if v:
            params[k] = v
    r = requests.get(
        "https://api.marketnewsapi.com/v1/news",
        params=params,
        headers={"Authorization": f"Bearer {os.environ['MARKETNEWSAPI_KEY']}"},
        timeout=10,
    )
    r.raise_for_status()
    return [
        {
            "time": a["published_at"],
            "title": a["title"],
            "summary": a["summary"] or a["snippet"],
            "symbols": a["tickers"],
            "source": a["source"]["name"],
            "url": a["url"],
        }
        for a in r.json()["data"]
    ]

Try it for 7 days. Signup starts Pro. A card is required. Real-time REST, WebSocket, and MCP, with no request cap. After that it's $15/month, or Free if you stop.

Start 7-day free trial

3. Prompt for grounded answers

system prompt
You are a markets assistant. When a question depends on recent events, call get_market_news first.
Answer only from the returned articles. Cite sources inline as [Source](url).
If the articles don't explain a move, say so instead of guessing. Never give investment advice.

4. Or index it for RAG

For research assistants that need weeks of context, stream articles into your vector store as they arrive (WebSocket all or ticker: channels) and embed title + summary. Store tickers, category, and published_at as metadata, so retrieval can filter before ranking by similarity.

5. Let agents discover the API

Agents and coding assistants can read our machine-readable docs directly: the OpenAPI 3.1 spec, llms.txt and pricing.md. Point your agent framework's OpenAPI importer at the spec to generate all tools at once.

Frequently asked questions

How do I give an AI agent live stock news?
Expose GET /v1/news as a tool with a few parameters, such as tickers, a keyword, and a look-back window. Return the title, summary, tickers, source, and URL, and tell the model to cite the URL and to say when the articles do not explain a move. Pro includes this REST access with no daily cap. The 7-day trial includes it. A card is required.
Should an agent read the full article or the summary?
Start with the summary. A short summary plus the title is far smaller than a scraped page, and it is already on the article. Keep the URL so the model can cite the source. Press releases also include full text if the task needs the wire copy. Publisher articles do not include the publisher's full body. The API is news, not a price feed.
Can I use MCP instead of defining my own tool?
Yes. Pro includes a remote MCP server for Claude, ChatGPT, Cursor, and other clients, and the 7-day trial includes it. That path is covered in the MCP guide and the MCP docs. A custom tool is better when you want a narrow function in your own agent. Free keys receive HTTP 403 from MCP. Burst is 20 requests per second, shared with REST.

Real-time stock news for $15 a month.

Start a 7-day Pro trial. A card is required. REST, WebSocket, and MCP are included. If you don't subscribe, the account stays on Free.