Skip to main content
Glama

Kelly Size Gate

size_gate
Read-onlyIdempotent

Deterministic position sizing (fractional Kelly) + risk-of-ruin. Given an edge — discrete {winProb, winLossRatio} or continuous {expectedReturn, volatility} — and a bankroll, returns the fractional-Kelly size and the probability of ever drawing down to 50/75/90%. The direct antidote to over-betting: full Kelly rides thin edges to ruin; this defaults to quarter-Kelly. Call before sizing ANY position.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
winProbNodiscrete mode: win probability in (0,1)
bankrollNobankroll in account units — recommended sizes are returned in the same units
volatilityNocontinuous mode: volatility per period (sigma)
winLossRatioNodiscrete mode: net win/loss odds b
kellyFractionNofraction of full Kelly to bet (default 0.25)
expectedReturnNocontinuous mode: excess return per period (mu)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okNofalse when the engine rejected the input
modeNodiscrete or continuous
noteNoplain-language guidance
modelNomodel assumptions used
proofNoVerifiability envelope: echoed inputs, engine codeHash, contentHash of this exact result, self-checks, EIP-712 signature (EAS-ready). Re-run the open engine on `inputs` to reproduce the result byte-for-byte.
checksNoGround-truth self-checks; the result is untrustworthy if any fails.
hasEdgeNofalse when the edge is non-positive (bet nothing)
leverageNoimplied leverage of the recommended size
riskOfRuinNoprobability of ever drawing down to 50/75/90% of bankroll
recommendedSizeNorecommended bet size in bankroll units
expectedLogGrowthNoexpected log-growth rate at the recommended size
fullKellyFractionNofull-Kelly fraction of bankroll (the ruinous ceiling, not the recommendation)
kellyFractionUsedNofraction of full Kelly applied (default 0.25)
impliedPortfolioVolPctNoportfolio volatility implied by the recommended size (%)
recommendedBetFractionNorecommended bet as a fraction of bankroll

TDQS

A4.4/5.0
Behavior4/5

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

The description adds behavioral context beyond annotations: it notes determinism, the fractional-Kelly approach, default quarter-Kelly, and drawdown thresholds (50/75/90%). Annotations already indicate read-only and idempotent, which are consistent. The description provides useful behavioral warnings (e.g., full Kelly rides thin edges to ruin).

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 three sentences long, front-loading the core purpose and key outputs. Every sentence adds critical information: what it does, inputs, outputs, and usage advisory. There is no wasted text.

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?

Given the complexity (6 parameters, output schema present), the description covers the essential behavioral and usage context. It mentions specific drawdown probabilities and the default fraction, which aids completeness. The output schema likely details return format, so the description is adequately comprehensive.

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?

Schema description coverage is 100%, so baseline is 3. The description adds value by explaining the two input modes (discrete: winProb+winLossRatio, continuous: expectedReturn+volatility) and the role of kellyFraction default. This helps agents understand parameter groupings beyond the individual descriptions.

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 clearly states the tool performs deterministic position sizing using fractional Kelly and risk-of-ruin analysis. It specifies the input modes (discrete vs continuous) and outputs (fractional-Kelly size and drawdown probabilities), and distinguishes itself as an antidote to over-betting. This is specific and differentiates from sibling tools.

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

Usage Guidelines4/5

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

The description explicitly says 'Call before sizing ANY position' and positions the tool as a direct antidote to over-betting, implying its primary use case. While it doesn't list when not to use or compare to alternatives explicitly, the context is clear enough for an AI agent to infer appropriate usage.

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.

TDQS

A4.6/5.0
Disambiguation5/5

Each tool addresses a distinct risk domain (event volatility, execution verification, LP risk, options, perps, portfolio, attestation, sizing, treasury) with no overlap; descriptions are precise and differentiate clearly.

Naming Consistency5/5

All tool names follow a consistent snake_case pattern combining a domain prefix with a verb or metaphor (e.g., _risk, _gate, _verify), making them predictable and easy to parse.

Tool Count5/5

The 9 tools cover a broad range of DeFi risk computations without being excessive; each tool serves a clear, non-redundant purpose within the server's scope.

Completeness5/5

The tool set provides comprehensive coverage for a risk analysis server: event risk, execution quality, LP risk, options and perps greeks, portfolio stress, attestation, sizing, and treasury risk; no obvious gaps for the intended domain.

Resources