Skip to main content
Glama
mothanaprime

Portfolio Rotation MCP Server

by mothanaprime

compute_attribution

Analyze trade attribution and rotation effectiveness by matching round-trips, computing swap alpha and benchmark-relative returns, and providing pattern analysis with calibration recommendations.

Instructions

Analyze trade attribution and rotation effectiveness.

Matches BUY/SELL trades into round-trips, computes swap alpha (what the replaced stock did), benchmark-relative returns, and pattern analysis with calibration recommendations.

Args: trades_json: JSON array of trades, e.g. '[{"date": "2025-01-15", "action": "BUY", "ticker": "NVDA", "shares": 50, "price": 120.00, "score": 75, "replaced": "INTC"}, ...]'. prices_json: JSON of price data from fetch_prices (the "prices" array). benchmark: Benchmark ticker (default "SPY").

Returns: JSON with round_trips (per-trade attribution, swap alpha) and patterns (win rate, avg return, score-return correlation, recommendations).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
trades_jsonYes
prices_jsonYes
benchmarkNoSPY

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations provided, the description carries full burden. It details the tool's behavior: matching trades into round-trips, computing swap alpha, benchmark-relative returns, and pattern analysis with recommendations. It does not mention side effects or permissions, but as a compute/analysis tool, this is sufficient.

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-structured with a brief intro, bulleted args, and returns. It is informative but slightly wordy, especially the trades example. Still, each sentence adds value and it is easy to parse.

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 tool's complexity (3 params, no nested objects, output schema exists), the description covers input format, return structure, and provides an example. It is complete and leaves no major gaps for an AI agent.

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 coverage is 0%, but the description provides rich semantics: explains trades_json format with an example, references prices_json from fetch_prices, and notes benchmark default. This fully compensates for the schema's lack of 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 analyzes trade attribution and rotation effectiveness, with specific details on matching trades into round-trips, computing swap alpha, and benchmark-relative returns. It distinguishes itself from siblings like compare_swaps or analyze_risk through its focus on attribution and recommendations.

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 description explains input requirements (trades_json from trades, prices_json from fetch_prices) but does not explicitly state when to use this tool versus alternatives like compare_swaps. It implies usage for attribution analysis but lacks exclusions or scenarios where other tools are more 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/mothanaprime/Rebalance-MCP'

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