Skip to main content
Glama

Build an equity strategy

build_equity_strategy
Destructive

Build a single-stock equity strategy, or rewrite one, and return its weights. Writes.

``strategy_id`` edits that strategy (only one this client owns). An edit replaces
the whole definition: omitted arguments revert to their defaults, so restate the
rest from ``get_strategy_definition``; ``name`` may be omitted to keep it. An edit
to a strategy with a track record rebuilds it in the background (``backtest_key``).

The universe is screened at every rebalance, so a backtest holds what the screen
picked on each date; ``regions`` is required. A screen or weighting is saved by
its ``request`` plus a name. ``asset_ids`` instead fixes the universe for the whole
history (other universe arguments go inert): a list the client brings. Ids copied
from a screen, a weighting or today's holdings give a backtest hindsight bias.

- ``sizes`` — 'large', 'mid', 'small', 'micro'; default large and mid.
- ``sectors`` / ``industries`` — GICS sectors, or GICS codes of 4, 6 or 8 digits
  from ``find_gics``; a code inside a named sector narrows it, else adds to it.
- ``esg_filter`` — 'exclude_worst' drops the exclusion list and the worst ESG
  decile; 'positive_tilt' drops the list and keeps the best three quarters.
- ``themes`` — maintained theme codes ('artificial_intelligence', 'defence', ...);
  several keep the members of any of them.

A lone theme or sector the catalogue carries returns its rows instead of building
(``build_anyway=True`` builds anyway); with a region, ESG screen, tilt or
non-default weighting it builds, and reports the rows beside it.

``fundamentals`` ranks the survivors on factor axes, each by default at its
usual end (cheap, high momentum, low debt, profitable, small, low volatility,
high yield, high growth). Valuation high is EXPENSIVE; 'quality' splits its
share between profitability and leverage. It keeps the top
``fundamentals_percentage_select`` (25% default); ~0.10 is a deep tilt, above
~0.50 a quality screen. ``min_dividend_yield`` then floors the yield.

``maximum_number_of_assets`` (default 100, at most 500) keeps the largest by
market cap, or under a tilt the top scores, ties larger first. The largest N are
this cap with no tilt, not a size tilt.

``company_exclude`` (names, exact, all listings) and ``theme_exclude`` (theme
codes) drop those companies, ``asset_ids`` included; matches are reported.

``construction``: 'market_cap' (by size, within the caps), 'equal' (ignores per-stock risk),
'min_risk' (lowest volatility) or 'risk_parity' (default). Caps bind every method.
``max_stock_weight`` is 10% by default; N names need 1/N, so a thin theme needs
more (1: no cap). Relaxed caps and unbuilt dates: ``notes`` (backtest's for past ones).

The weights are one solve for today. ``backtest=True`` also queues the history
backtest, which writes the ledger; follow ``backtest_key``.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "build_equity_strategy"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameNo
sizesNo
themesNo
regionsNoISO-3 country codes ('SWE'), country names ('Sweden') or the groups 'global', 'nordics', 'europe' (which includes the Nordics) and 'north_america'. Where a company is LISTED, not where it is based: a foreign company with a local listing counts in that country.
sectorsNo
backtestNo
asset_idsNo
esg_filterNo
industriesNo
strategy_idNo
build_anywayNo
constructionNorisk_parity
fundamentalsNo
gics_excludeNoGICS codes whose companies are dropped, at any level: 2-digit sectors, or 4-, 6- and 8-digit codes from find_gics.
history_yearsNo
theme_excludeNo
assumed_aum_usdNo
company_excludeNo
max_stock_weightNo
max_sector_weightNo
max_country_weightNo
min_dividend_yieldNoKeep only companies whose trailing 12-month dividend yield is at least this, e.g. 0.03 for 3%. Applied after a tilt: the tilt keeps its share (fundamentals_percentage_select) of the screened universe, then the floor keeps the yielders among those.
rebalance_frequencyNoquarterly
max_adv_participationNoLargest share of a stock's one-month average daily volume one position may equal. The volume is the primary listing's alone, not consolidated across venues and dark pools, so the limit is conservative.
maximum_number_of_assetsNoAt most 500; empty means 500.
fundamentals_percentage_selectNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / $defs / AssumedAum / description
      Previous value: -"Portfolio size in USD to size a liquidity limit for: no position above max_adv_participation of the stock's one-month average daily volume at this size. Binds risk_parity and min_risk only. Omitted: no liquidity limit."New value: +"Portfolio size in USD to size a liquidity limit for: no position above max_adv_participation of the stock's one-month average daily volume at this size. Omitted: no liquidity limit."
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and non-idempotent writes, and the description goes well beyond them: an edit replaces the whole definition, an edit to a strategy with a track record rebuilds it in the background, backtest=True queues history and writes the ledger, and relaxed caps surface in notes. It also warns that ids copied from screens or today's holdings introduce hindsight bias and that caps bind every construction method.

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?

It is long, but front-loaded with the write/edit contract and organized into bullets keyed to parameter names, so scanning is cheap. A few sentences are telegraphic to the point of ambiguity (e.g. 'The largest N are this cap with no tilt, not a size tilt'), costing some clarity against a tool this dense.

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 26-parameter mutation tool with no output schema, it covers the decision-critical behavior: screening at every rebalance, edit replacement semantics, background backtest and backtest_key to follow, and where relaxed caps are reported. What it does not state is the shape of the immediate response beyond 'weights' (strategy id, notes, rows returned instead of a build), which an agent needs in order to chain into run_strategy_backtest or get_strategy_definition.

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?

With only 19% schema description coverage, the description carries the load and does so for the hard parts: sizes, sectors/industries code nesting, esg_filter behavior, theme union semantics, factor-tilt default directions (valuation high = EXPENSIVE, quality as one axis), the percentage_select interpretation (~0.10 deep tilt vs ~0.50 quality screen), the asset cap's interaction with tilts, and the 1/N cap argument. A few parameters (rebalance_frequency, max_sector_weight, max_country_weight) are never mentioned, so it does not fully close the coverage gap.

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 first sentence names a specific verb and resource ('Build a single-stock equity strategy, or rewrite one') plus the return ('its weights') and the mutation character ('Writes'). It is clearly distinguishable from siblings like build_allocation_strategy or solve_equity_weights, which are not single-stock strategy builders.

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?

It spells out the create-vs-edit fork ('strategy_id edits that strategy'), the consequence of editing (omitted arguments revert to defaults, restate from get_strategy_definition), and the asset_ids-vs-screen fork including the hindsight-bias warning. It also states the exception path ('a lone theme or sector the catalogue carries returns its rows instead of building; build_anyway=True builds anyway') and routes the agent to find_gics for codes.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources