Skip to main content
Glama
Dilane-Kamga

BRVM MCP Server

by Dilane-Kamga

get_market_summary

Retrieve today's BRVM market summary including total volume, value traded, number of gainers and losers, and all index values. Get a complete trading session overview in JSON format.

Instructions

Get today's BRVM market summary including total volume, value traded, number of gainers/losers, and all index values.

Returns a JSON object with the full trading session overview.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Tool registration and execution handler for get_market_summary. Decorated with @mcp.tool(), it checks cache first, then delegates to scraper.get_market_summary(), serializes the MarketSummary model to JSON, and caches the result.
    @mcp.tool()
    async def get_market_summary() -> str:
        """
        Get today's BRVM market summary including total volume, value traded,
        number of gainers/losers, and all index values.
    
        Returns a JSON object with the full trading session overview.
        """
        assert scraper and cache
    
        cached = cache.get("market_summary")
        if cached:
            return json.dumps(cached, ensure_ascii=False, indent=2)
    
        summary = await scraper.get_market_summary()
        data = summary.model_dump()
        cache.set("market_summary", data)
        return json.dumps(data, ensure_ascii=False, indent=2)
  • Pydantic model MarketSummary defining the schema: date, total_volume, total_value, market_cap, gainers, losers, unchanged, and a list of IndexValue objects.
    class MarketSummary(BaseModel):
        """Aggregate BRVM trading session summary."""
    
        date: str = Field(..., description="Trading date")
        total_volume: int = Field(0, description="Total shares traded")
        total_value: float = Field(0.0, description="Total value traded in XOF")
        market_cap: float = Field(0.0, description="Total market capitalization in XOF")
        gainers: int = Field(0, description="Number of stocks that gained")
        losers: int = Field(0, description="Number of stocks that declined")
        unchanged: int = Field(0, description="Number of unchanged stocks")
        indices: list[IndexValue] = Field(default_factory=list)
  • Registration via @mcp.tool() decorator on line 83, registering the function as an MCP tool named 'get_market_summary'.
    @mcp.tool()
    async def get_market_summary() -> str:
  • Scraper method get_market_summary() that scrapes the BRVM page, calls get_all_quotes() and get_indices(), computes gainers/losers/unchanged counts, parses market cap and total value, and returns a MarketSummary Pydantic model.
    async def get_market_summary(self) -> MarketSummary:
        """Build a full market summary from scraped data."""
        resp = await self._get_with_retry(f"{AFX_BASE}/")
        soup = BeautifulSoup(resp.text, "lxml")
    
        quotes = await self.get_all_quotes()
        indices = await self.get_indices()
    
        gainers = [q for q in quotes if q.change_pct > 0]
        losers = [q for q in quotes if q.change_pct < 0]
        unchanged = [q for q in quotes if q.change_pct == 0]
    
        # Parse market cap from the summary table ("XOF 15.51Tr")
        market_cap = 0.0
        for table in soup.find_all("table"):
            th = table.find("th")
            if th and "BRVM-CI" in th.get_text():
                cells = table.find_all("td")
                if len(cells) >= 3:
                    cap_text = cells[2].get_text(strip=True)
                    cap_m = re.search(r"([\d.,]+)\s*Tr", cap_text)
                    if cap_m:
                        market_cap = self._parse_number(cap_m.group(1)) * 1e12
                break
    
        # Parse total volume/value from trading summary paragraph
        full_text = soup.get_text()
        total_volume = sum(q.volume for q in quotes)
        total_value = 0.0
        val_m = re.search(r"XOF\s*([\d,. ]+)", full_text)
        if val_m:
            total_value = self._parse_number(val_m.group(1))
    
        return MarketSummary(
            date=datetime.now().strftime("%Y-%m-%d"),
            total_volume=total_volume,
            total_value=total_value,
            market_cap=market_cap,
            gainers=len(gainers),
            losers=len(losers),
            unchanged=len(unchanged),
            indices=indices,
        )
Behavior3/5

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

No annotations provided, so description carries full burden. It states returns a JSON object with trading session overview, but no side effects, auth needs, or rate limits are mentioned. Adequately discloses return content.

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?

Two tightly written sentences with no fluff. Front-loaded with key information and precise.

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

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Output schema exists, so description needn't detail return values. Mentions key fields. For a parameterless market summary, description is complete given schema presence.

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?

No parameters in schema (100% coverage), so description naturally adds no extra parameter info. Baseline score of 4 applies as no compensation needed.

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 it gets today's BRVM market summary with specific data points (volume, value, gainers/losers, index values), distinguishing it from sibling tools like get_company_info (company-specific) and get_indices (just indices).

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?

Implies use for a market overview, but lacks explicit when-to-use vs. alternatives. No guidance on when not to use or exclusions, leaving some ambiguity.

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