Skip to main content
Glama

rolling_stats

Calculate rolling mean and volatility for financial symbols to analyze price trends and market fluctuations over specified time windows.

Instructions

Computes rolling mean and volatility.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes
windowNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'rolling_stats' tool. Downloads 1y price data via yfinance, computes rolling mean and standard deviation (volatility) over the specified window on closing prices, and returns the last 10 values as JSON.
    def rolling_stats(symbol: str, window: int = 20) -> str:
        """Computes rolling mean and volatility."""
        df = yf.download(symbol, period="1y", progress=False)
        if df.empty: return "No data"
        
        close = df['Close']
        if isinstance(close, pd.DataFrame): close = close.iloc[:, 0]
        
        stats = pd.DataFrame()
        stats['Mean'] = close.rolling(window=window).mean()
        stats['Std'] = close.rolling(window=window).std()
        
        return stats.tail(10).to_json(orient="index")
  • server.py:390-393 (registration)
    Registration of the rolling_stats tool (along with related feature engineering tools) to the MCP server using the register_tools helper, which applies @mcp.tool() decorator.
    register_tools(
        [compute_indicators, rolling_stats, get_technical_summary],
        "Feature Engineering"
    )
  • app.py:291-291 (registration)
    Inclusion of rolling_stats in the tools_map dictionary under 'Technical Analysis' category for the Gradio UI toolbox interface.
    "Technical Analysis": [compute_indicators, rolling_stats, get_technical_summary],
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions computing rolling mean and volatility but doesn't disclose behavioral traits such as data source, time frame, output format, error handling, or computational requirements. This leaves significant gaps for a tool with parameters and an output schema.

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?

The description is extremely concise with a single sentence that directly states the tool's function. It is front-loaded and wastes no words, making it efficient and easy to parse.

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 tool has an output schema, the description doesn't need to explain return values. However, with no annotations, 2 parameters, and 0% schema coverage, the description is minimal and lacks context on usage, behavior, or parameter details, making it adequate but incomplete for effective tool 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?

Schema description coverage is 0%, so the description must compensate, but it adds no information about parameters beyond what the schema provides (symbol and window). It implies these parameters are used for the computation but doesn't explain their roles, units, or constraints, resulting in a baseline score due to the lack of enhancement.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool computes rolling mean and volatility, which is a specific verb (computes) and resource (rolling statistics). It distinguishes from siblings like 'compute_indicators' or 'get_technical_summary' by focusing specifically on rolling calculations, though it doesn't explicitly contrast with them.

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?

The description provides no guidance on when to use this tool versus alternatives like 'compute_indicators' or 'get_technical_summary', nor does it mention prerequisites or context for application. It only states what it does, not when it's appropriate.

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/N-lia/MonteWalk'

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