Skip to main content
Glama
Dilane-Kamga

BRVM MCP Server

by Dilane-Kamga

get_top_movers

Get today's top gaining and losing stocks on the BRVM exchange. Adjust the number of stocks returned per category (default 5, max 10) for tailored market movers.

Instructions

Get today's top gaining and losing stocks on the BRVM.

Args: n: Number of stocks to return per category (default 5, max 10).

Returns a JSON object with 'gainers' and 'losers' arrays.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for get_top_movers. Decorated with @mcp.tool(), it accepts an optional 'n' parameter (default 5, max 10), checks cache, delegates to scraper.get_top_movers(), and returns JSON with 'gainers' and 'losers' arrays.
    @mcp.tool()
    async def get_top_movers(n: int = 5) -> str:
        """
        Get today's top gaining and losing stocks on the BRVM.
    
        Args:
            n: Number of stocks to return per category (default 5, max 10).
    
        Returns a JSON object with 'gainers' and 'losers' arrays.
        """
        assert scraper and cache
        n = min(max(n, 1), 10)
    
        cached = cache.get(f"top_movers:{n}")
        if cached:
            return json.dumps(cached, ensure_ascii=False, indent=2)
    
        movers = await scraper.get_top_movers(n=n)
        data = {
            "gainers": [m.model_dump() for m in movers["gainers"]],
            "losers": [m.model_dump() for m in movers["losers"]],
        }
        cache.set(f"top_movers:{n}", data)
        return json.dumps(data, ensure_ascii=False, indent=2)
  • Core scraping logic: fetches all quotes via get_all_quotes(), filters active stocks (volume > 0), sorts by change_pct descending for gainers and ascending for losers, maps to TopMover objects, and returns a dict with 'gainers' and 'losers' lists.
    async def get_top_movers(self, n: int = 5) -> dict[str, list[TopMover]]:
        """Get top N gainers and losers."""
        quotes = await self.get_all_quotes()
        active = [q for q in quotes if q.volume > 0]
    
        sorted_up = sorted(active, key=lambda q: q.change_pct, reverse=True)
        sorted_down = sorted(active, key=lambda q: q.change_pct)
    
        def to_mover(q: StockQuote) -> TopMover:
            return TopMover(
                ticker=q.ticker,
                name=q.name,
                price=q.price,
                change_pct=q.change_pct,
                volume=q.volume,
            )
    
        return {
            "gainers": [to_mover(q) for q in sorted_up[:n]],
            "losers": [to_mover(q) for q in sorted_down[:n] if q.change_pct < 0],
        }
  • Pydantic model TopMover with fields: ticker (str), name (str), price (float), change_pct (float), volume (int). Used for serialization of top gainer/loser stocks.
    class TopMover(BaseModel):
        """A stock appearing in top gainers or top losers."""
    
        ticker: str
        name: str
        price: float
        change_pct: float
        volume: int
  • FastMCP server instance creation; the @mcp.tool() decorator on line 152 registers get_top_movers as an MCP tool.
    mcp = FastMCP(
        "BRVM Market Data",
        instructions=(
            "Live market data from the BRVM (Bourse Régionale des Valeurs Mobilières), "
            "the regional stock exchange of 8 West African UEMOA member states. "
            "Provides stock quotes, index values, top movers, company info, and market summaries."
        ),
        lifespan=lifespan,
    )
Behavior3/5

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

No annotations provided, so description bears full burden. It discloses basic behavior: returns JSON with 'gainers' and 'losers' arrays. However, it omits potential edge cases (e.g., market closed, no movers) and does not explicitly state it is read-only or require authentication.

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?

Three concise sentences: one for purpose, one for parameter, one for return format. No extraneous information; every sentence adds value.

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?

The description covers purpose, parameter, and return format. With an output schema present, return details are sufficient. However, it lacks a definition of 'top' (e.g., percentage change or absolute change), which would improve completeness for a first-time user.

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

Parameters5/5

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

Input schema has 0% description coverage, but the description clearly explains parameter 'n': its purpose ('Number of stocks to return per category'), default (5), and maximum (10). This fully compensates for the schema's lack of descriptions.

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?

Description clearly states the tool retrieves 'today's top gaining and losing stocks on the BRVM,' specifying verb, resource, and scope. It distinguishes from siblings like 'get_stock_price' (single stock) and 'get_market_summary' (broader market data).

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

Usage Guidelines3/5

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

Usage context is implied (for daily top movers) but no explicit guidance on when to use this tool versus alternatives like 'get_stock_price' or 'search_stocks'. No exclusions or prerequisites mentioned.

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/Dilane-Kamga/brvm-mcp-server'

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