Agent Financial Advisor

v0.1.0
io.github.mytomclinic/agent-financial-advisor Checked 4 days ago Published 1 month ago

Compliance, risk, tax and audit checks for AI trading agents: pre-trade, sizing, wash sales, Reg BI.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

rules_digest Current trading rules digest

Free. The current US trading, margin, settlement and tax rules an agent must follow, with effective dates and sources. Includes changes your training data may predate, such as the June 2026 replacement of the Pattern Day Trader rule. Price: free.

ParameterTypeDescription
api_keystringOptional. Your AFA API key (afa_...), from get_api_key. Pass it on every call so free calls and credits apply; without it calls use the anonymous trial.
topicstring

pre_trade_check Pre-trade compliance and risk check

Run an order past a compliance officer and risk manager before sending it to the broker. Checks buying power, cash-account settlement violations, FINRA intraday margin (post-PDT) or legacy PDT limits, Reg SHO short-sale rules, wash-sale exposure, position concentration, per-trade risk versus stop, liquidity, spread, fat-finger prices, leverage and market hours. Returns approve / approve_with_warnings / reject with reasons and a resized quantity when useful. Price: $0.005.

ParameterTypeDescription
account *objectAccount state before the order.
order *object
api_keystringOptional. Your AFA API key (afa_...), from get_api_key. Pass it on every call so free calls and credits apply; without it calls use the anonymous trial.
marketobject
policyobjectOverride risk limits. Defaults: {"max_position_pct":0.2,"max_order_risk_pct":0.02,"max_adv_pct":0.05,"max_spread_pct":0.01,"max_gross_leverage":2,"max_limit_deviation_pct":0.1,"allow_short":true,"allo…

position_size Position sizing

Size a position the way a risk manager would: fixed-fractional risk to a stop, volatility targeting (ATR or annualized vol), or fractional Kelly from your edge statistics. Applies a max-position cap and round lots, and explains the binding constraint. Price: $0.005.

ParameterTypeDescription
entry_price *number
equity *number
method *fixed_fractional needs stop_price; volatility needs atr or annual_vol; kelly needs win_rate, avg_win and avg_loss.
allow_fractionalboolean
annual_volnumbervolatility: annualized volatility of the asset (e.g. 0.35).
api_keystringOptional. Your AFA API key (afa_...), from get_api_key. Pass it on every call so free calls and credits apply; without it calls use the anonymous trial.
atrnumbervolatility: average true range in price units.
atr_multiplenumbervolatility: stop distance in ATRs, default 2.
avg_lossnumberkelly: average loss as a positive number.
avg_winnumberkelly: average win (any unit, same as avg_loss).
kelly_fractionnumberkelly: fraction of full Kelly to use, default 0.25.
lot_sizeintegerRound down to this multiple, default 1.
max_position_pctnumberCap on position value / equity, default 0.2.
risk_pctnumberfixed_fractional: fraction of equity to risk, default 0.01.
side
stop_pricenumberfixed_fractional: the protective stop price. Without it the answer is only the position-cap maximum (risk_sized: false).
target_annual_vol_contributionnumbervolatility: target vol contribution as fraction of equity, default 0.02.
win_ratenumberkelly: probability of a win (0-1).

tax_lot_plan Tax lot selection and wash-sale check

Act as the tax advisor for a sale: compares FIFO, LIFO, HIFO and minimum-tax lot selection, splits short- and long-term gains, estimates tax, flags wash sales, and notes lots about to turn long-term. With mode=harvest it scans positions for tax-loss harvesting. Price: $0.02.

ParameterTypeDescription
lots *array
api_keystringOptional. Your AFA API key (afa_...), from get_api_key. Pass it on every call so free calls and credits apply; without it calls use the anonymous trial.
as_ofstringmode=harvest: date, default today
min_harvest_lossnumbermode=harvest: ignore losses smaller than this (USD), default 100.
mode
pricesobjectmode=harvest: {SYMBOL: current price}
recent_transactionsarray
sellobjectmode=sell
symbolstring
tax_ratesobject

portfolio_review Portfolio review

A periodic advisor review of a portfolio: weights, concentration (HHI and effective number of holdings), sector and asset-class exposure, drift from targets with the trades to rebalance, and, given return history, volatility, Sharpe, Sortino, drawdown, VaR/CVaR and beta. Ends with prioritized findings. Price: $0.05.

ParameterTypeDescription
holdings *array
api_keystringOptional. Your AFA API key (afa_...), from get_api_key. Pass it on every call so free calls and credits apply; without it calls use the anonymous trial.
benchmark_returnsarray
cashnumber
limitsobject
periods_per_yearnumber
rebalance_bandnumberAbsolute drift that triggers a rebalance, default 0.05.
returnsarrayPeriodic portfolio returns as decimals.
risk_free_ratenumber
targetsobjectTarget weights by symbol or asset_class, summing to 1.

strategy_audit Strategy audit and overfitting check

An independent performance auditor for a trading strategy or backtest. From a trade list and/or periodic returns it computes win rate, expectancy, profit factor, streaks, Sharpe/Sortino/drawdown, and tests whether the edge is real: t-stat, Probabilistic Sharpe Ratio and the Deflated Sharpe Ratio that corrects for how many variants you tried. Returns a verdict and red flags. Price: $0.1.

ParameterTypeDescription
api_keystringOptional. Your AFA API key (afa_...), from get_api_key. Pass it on every call so free calls and credits apply; without it calls use the anonymous trial.
avg_trial_correlationnumberAverage pairwise correlation (0 to 1) between the returns of the variants you tested. Near-duplicate variants (a 20-day vs. 21-day lookback) are not independent trials; with this the audit deflates by…
n_trialsintegerHow many strategy/parameter variants were tested before picking this one. Default 1.
periods_per_yearnumber
returnsarrayPeriodic strategy returns as decimals.
starting_equitynumberFor risk-of-ruin and drawdown in dollars from trades.
tradesarrayClosed trades.
trial_sharpe_variancenumberVariance of per-period Sharpe across trials, if known.

suitability_check Best-interest suitability review

The compliance review a robo-advisor or advisory agent should run before recommending a portfolio to a person: compares the proposal with the client's age, horizon, risk tolerance, liquidity needs and experience under Reg BI / fiduciary standards, flags complex products, and returns a timestamped, hashed suitability memo for the audit file. Price: $0.03.

ParameterTypeDescription
allocation *objectWeights by asset class: equity, bonds, cash, alternatives, crypto... summing to 1.
client *object
annual_fee_pctnumberAll-in annual cost (advisory + fund expenses).
api_keystringOptional. Your AFA API key (afa_...), from get_api_key. Pass it on every call so free calls and credits apply; without it calls use the anonymous trial.
max_single_position_pctnumber
productsarrayComplex products included.

options_risk_check Options risk and margin check

Check an options book (existing or proposed legs) the way a broker's options desk would: covered, cash-secured, spread or naked; margin requirement under FINRA Rule 4210; cash-account limits; required approval level; early-assignment risk around ex-dividend dates; pin risk; auto-exercise of expiring in-the-money longs and the capital it needs; max loss; and net Greeks. Returns approve / approve_with_warnings / reject with reasons. Price: $0.01.

ParameterTypeDescription
account *object
legs *array
underlying *object
api_keystringOptional. Your AFA API key (afa_...), from get_api_key. Pass it on every call so free calls and credits apply; without it calls use the anonymous trial.
as_ofstringDate of the check (YYYY-MM-DD); defaults to today in New York.
policyobjectOverrides: pin_band_pct, max_requirement_pct_of_equity, max_delta_dollars_pct_of_equity, assignment_dte, low_extrinsic.

advisor_memo Advisor memo (written by Claude)

Send a planned trade, options position or portfolio and get a written decision memo: proceed, proceed with changes, or do not proceed, with the risks, the exact changes to make, the rules that apply and a dated note for your audit file. Runs pre_trade_check, position_size, tax_lot_plan, options_risk_check and portfolio_review on whichever sections you send, then Claude writes the memo; it never overrides a failed check. Paid only (credits or x402), except that each API key's first memo is free; the daily free calls and the anonymous trial don't cover it. Price: $0.1, paid only.

ParameterTypeDescription
api_keystringOptional. Your AFA API key (afa_...), from get_api_key. Pass it on every call so free calls and credits apply; without it calls use the anonymous trial.
contextstringOptional: your plan and thesis in plain words (up to 2000 characters).
optionsobjectAn options_risk_check request.
portfolioobjectA portfolio_review request.
sizingobjectA position_size request.
tax_lotsobjectA tax_lot_plan request, for a planned sale.
tradeobjectA pre_trade_check request: {account, order, market?, policy?}.

get_api_key Get a free API key

Free. Creates an API key for this agent (25 free calls a day, then prepaid credits) and attaches it to this MCP session, so the next calls use it automatically. Call this when the anonymous trial runs out. Save the key and add ?key=<key> to the MCP URL (or send Authorization: Bearer <key>) to keep using it in later sessions.

ParameterTypeDescription
labelstringOptional name for the key, such as your agent's name.

my_account Check this agent's key

Free. Shows the API key's free calls left today and when they reset, prepaid credit balance, whether its one free advisor_memo is still available, and how to add credits.

ParameterTypeDescription
api_keystringOptional. Your AFA API key (afa_...), from get_api_key. Pass it on every call so free calls and credits apply; without it calls use the anonymous trial.