Skip to main content
Glama
jihjihk

QuantContext

by jihjihk

factor_analysis

Read-onlyIdempotent

Determine if your strategy's returns stem from genuine alpha or market factor exposure. Decomposes equity curves into Fama-French factor loadings with statistical significance.

Instructions

Decompose strategy or portfolio returns into Fama-French factors using OLS regression.

Breaks down returns into exposures to four systematic factors:

  • Mkt-RF (market risk premium): how much return comes from overall market movement

  • SMB (small minus big): size factor exposure

  • HML (high minus low): value factor exposure

  • Mom (momentum): momentum factor exposure

Also estimates alpha (excess return not explained by factors) with t-statistic for statistical significance. A |t-stat| > 2 suggests statistically significant alpha.

Returns alpha (daily and annualized), factor loadings with t-statistics, R-squared (how much of return variance is explained by factors), and residual volatility.

Use this after backtest_strategy to understand WHERE your returns come from — is it genuine alpha or just factor exposure?

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
equity_curveYesEquity curve as a list of {date, value} objects. Typically from the output of backtest_strategy. Needs at least 30 data points. Example: [{date: '2023-01-03', value: 100000}, {date: '2023-01-04', value: 100500}, ...]

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

Annotations already convey readOnlyHint and non-destructive nature. Description adds value by detailing the statistical interpretation (alpha with t-stat significance threshold, R-squared, residual volatility) and listing the four factors. No contradictions.

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?

Description is concise yet thorough, using bullet points for factors and clear paragraphs. Front-loaded with main purpose, then details, then usage guidance. Every sentence adds value.

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?

Given the output schema exists (not shown but known from context), description doesn't need to itemize return values. It covers prerequisites, interpretation guidance (t-stat cutoff), and outputs conceptually, making it complete for the tool's complexity.

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 coverage is 100% with a detailed description for the single parameter. The description provides additional context by noting the parameter typically comes from backtest_strategy output and including an example. Baseline 3 is appropriate as schema already does heavy lifting.

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?

The description begins with a specific verb ('Decompose') and resource ('strategy or portfolio returns into Fama-French factors'), clearly stating what the tool does. It distinguishes from siblings by explicitly recommending usage 'after backtest_strategy to understand WHERE your returns come from — is it genuine alpha or just factor exposure?'

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

Usage Guidelines5/5

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

Explicitly states when to use ('after backtest_strategy'), and provides conditions ('Needs at least 30 data points'). No explicit exclusions for alternatives, but context clarifies its purpose relative to sibling tools.

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/jihjihk/quantcontext-mcp-server'

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