Skip to main content
Glama

seasonal_decompose

Decompose time series data into trend, seasonal, and residual components to uncover underlying patterns. Choose additive or multiplicative models or let it auto-detect periodicity for analysis.

Instructions

seasonal_decompose —— 时序组 · 季节分解(工具 18,简化实现)。

docstring = agent 使用说明书,与 statlab_mcp/docs/design/06_timeseries.md 同步维护。

参数: file_path (str): 本地数据文件(csv/tsv/xlsx/json) date_col / value_col (str): 日期列与数值列 period (int|None, None): 周期;默认 FFT 主频自动估计(_common._estimate_period) model (str, "auto"): additive / multiplicative / auto auto: 全正值 -> multiplicative,否则 additive(注明选择依据)

口径: statsmodels.seasonal_decompose(extrapolate_trend="freq"); multiplicative 要求全正值(显式指定且含非正值 -> 中文报错)。 输出分量统计 + 最后完整周期季节因子 + 4 子图(image 顶层)。

示例: seasonal_decompose("samples/timeseries.csv", date_col="date", value_col="value") inline 数据: 本工具支持可选 inline_data 参数(v1.2.0 起):与 file_path 二选一, 支持 records 数组或 {"header": [...], "rows": [[...], ...]} 对象两种形态; 规模上限/类型域/data_source 来源标注见 statlab_mcp/docs/SPEC.md 第 12 节。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNoauto
periodNo
date_colNo
file_pathNo
value_colNo
inline_dataNo

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv1.2.0

TDQS

A4.2/5.0
Behavior5/5

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

With no annotations to carry the safety/behavioral burden, the description provides rich behavioral disclosure: it names the exact underlying call including extrapolate_trend='freq', explains the auto model-selection rule, documents the all-positive requirement for multiplicative decomposition and the resulting Chinese error, and describes the output shape (component statistics, seasonal factors, four subplots). This exceeds what any structured annotation would typically provide.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-sectioned and front-loads purpose and parameters before behavior and example. It is longer than strictly necessary due to maintenance/version notes and an external-doc pointer, but those additions are minor and don't obscure the actionable content.

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?

For a tool with no output schema, the description covers inputs, model selection, constraints, error behavior, and high-level return content (component statistics, seasonal factors, four plots). It is slightly incomplete in that it defers inline_data scale/type limits to an external spec and doesn't enumerate the exact output fields, but an agent has enough to invoke it correctly.

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?

Schema description coverage is 0%, so the description must supply parameter meaning, and it does so for all six parameters: file formats for file_path, roles of date_col/value_col, FFT-based period auto-estimation, the additive/multiplicative/auto choices, and the two supported inline_data shapes. It also adds a mutual-exclusion rule between file_path and inline_data that the schema does not express.

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 identifies a specific operation — seasonal decomposition of a time series — with a concrete implementation (statsmodels.seasonal_decompose) and a simplified-implementation qualifier. It does not explicitly contrast itself with sibling time-series tools such as trend_analysis or time_series_forecast, so it falls just short of full sibling differentiation.

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?

The use case is implied through the tool name, '时序组 · 季节分解', the parameter list, and an example, but there is no explicit statement of when to choose this tool over alternatives or when not to use it. The model-selection notes ('auto: 全正值 -> multiplicative,否则 additive') provide parameter-level guidance but not tool-selection guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/good-boy4069/statlab-mcp'

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