> ## Documentation Index
> Fetch the complete documentation index at: https://docs.askfutures.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP tools

> The complete reference for every AskFutures MCP tool — what it does, its key inputs, and what it returns — grouped by sessions, strategies, backtest & optimize, reference, and utility.

The AskFutures MCP server registers **16 tools**. They fall into five groups:
manage [sessions](#sessions), build and read [strategies](#strategies), run
[backtests & optimizations](#backtests-amp-optimizations), look up
[reference data](#reference-data), and a couple of [utilities](#utility).

<Note>
  Two patterns run through every tool. First, almost everything takes a
  `session_id` — create or list a session before anything else. Second, building,
  backtesting, and optimizing are **asynchronous**: the kickoff tool returns an
  id, and you call `wait_for_completion` to learn the result. See
  [developer concepts](/developers/concepts) for the model.
</Note>

## Sessions

| Tool             | What it does                          | Key inputs                                                                                          | Output                                                      |
| ---------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| `create_session` | Create a workspace for strategy work. | `title` *(optional)*                                                                                | New `session_id` + `app_url`.                               |
| `list_sessions`  | List sessions you own.                | `status` (`active` \| `archived` \| `all`, default `active`), `limit` (1–100, default 20), `cursor` | Array of sessions, each with an `app_url`, plus pagination. |
| `get_session`    | Fetch one session by id.              | `session_id`                                                                                        | The session + `app_url`.                                    |

## Strategies

| Tool               | What it does                                                                                         | Key inputs                                                                                                          | Output                                                                                                  |
| ------------------ | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `list_strategies`  | List the strategy artifacts in a session, including the **canonical parameters** needed to optimize. | `session_id`                                                                                                        | Summaries (`artifact_id`, `version`, `ticker`, `backtestStatus`, `canonicalParameters`, …) + `app_url`. |
| `inspect_strategy` | Fetch one strategy in full.                                                                          | `session_id`, `artifact_id`                                                                                         | Entry/exit rules, exit conditions, parameters, extraction plan, and backtest status.                    |
| `create_strategy`  | **Start** building a new strategy from a plain-English description. Asynchronous.                    | `session_id`, `description`, `backtest` *(default `true`)*, `provider` *(optional)*, `idempotency_key` *(optional)* | An `operation_id` — call `wait_for_completion` next.                                                    |
| `update_strategy`  | **Start** modifying an existing strategy. Asynchronous; saves a new version.                         | `session_id`, `artifact_id`, `changes`, `provider` *(optional)*                                                     | An `operation_id` — call `wait_for_completion` next.                                                    |
| `delete_strategy`  | Delete a draft strategy artifact. Refuses unless confirmed.                                          | `session_id`, `artifact_id`, `confirm` *(must be `true`)*                                                           | Deletion result.                                                                                        |

<Warning>
  `create_strategy` and `update_strategy` return **before** the strategy is
  ready. The artifact is `creating` until `wait_for_completion` reports
  `succeeded`. Don't backtest or optimize against it before then.
</Warning>

## Backtests & optimizations

| Tool                         | What it does                                                          | Key inputs                                                                                                                         | Output                                                                  |
| ---------------------------- | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| `backtest_existing_strategy` | Run (or re-run) a backtest on an existing artifact. No fork.          | `session_id`, `artifact_id`                                                                                                        | Backtest started — poll with `wait_for_completion` (`task='backtest'`). |
| `setup_optimization`         | Configure a parameter sweep on a backtested strategy.                 | `session_id`, `artifact_id`, `parameters` (array of `{ name, min, max, step }`)                                                    | An `optimization_id` (batch is configured, not yet running).            |
| `run_optimization`           | Promote a configured sweep to running — one backtest per combination. | `session_id`, `artifact_id`, `optimization_id`                                                                                     | Run started — poll with `wait_for_completion` (`task='optimization'`).  |
| `wait_for_completion`        | Poll any async task until it finishes or times out.                   | `session_id`, `task` (`strategy_op` \| `backtest` \| `optimization`), plus the matching ids, `timeout_seconds` (1–300, default 45) | The finished result, or a `timed_out` status to poll again.             |
| `cancel_task`                | Request cancellation of an in-flight task. Idempotent.                | `session_id`, `task`, plus the matching ids                                                                                        | Cancel acknowledged.                                                    |

<Info>
  `create_strategy` runs a backtest by default, so most new strategies arrive
  already tested. Reach for `backtest_existing_strategy` only when the strategy
  was created with `backtest=false`, when its `backtestStatus` is `not_tested`
  or `failed`, or when you want a deliberate re-run.
</Info>

### Picking the right `task` and ids

`wait_for_completion` and `cancel_task` are keyed by `task`. Match the id(s) to
the task:

| `task`         | Required id(s)                          | Polls / cancels                                    |
| -------------- | --------------------------------------- | -------------------------------------------------- |
| `strategy_op`  | `operation_id`                          | A `create_strategy` / `update_strategy` operation. |
| `backtest`     | `artifact_id`                           | The artifact's `backtestStatus`.                   |
| `optimization` | `artifact_id` **and** `optimization_id` | The batch's status.                                |

<Note>
  **Cancellation is best-effort and differs by task.** For an optimization, the
  session's single running sweep stops between combinations and partial results
  are kept. For a backtest or a strategy create/update, cancel only takes effect
  if the worker hasn't started — short in-flight tasks are allowed to finish.
</Note>

## Reference data

| Tool                 | What it does                                                    | Key inputs | Output                                                   |
| -------------------- | --------------------------------------------------------------- | ---------- | -------------------------------------------------------- |
| `list_symbols`       | List every tradable CME Group symbol (CME, CBOT, NYMEX, COMEX). | *(none)*   | `count` + `symbols`, each with ticker, name, and sector. |
| `get_reference_data` | Look up one contract's specs.                                   | `symbol`   | Tick size, tick value, margin, session hours, and more.  |

<Tip>
  Call `list_symbols` to discover what you can trade, then `get_reference_data`
  for the exact tick math before you size stops and targets. The same specs are
  on the [contract specs](/reference/contract-specs) and
  [supported symbols](/reference/supported-symbols) reference pages.
</Tip>

## Utility

| Tool          | What it does                                                                                                            | Key inputs                                                                                                        | Output        |
| ------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ------------- |
| `write_todos` | Replace the session's task list (full-replace — send the whole list every call). Useful when an async wait spans turns. | `session_id`, `todos` (array of `{ id, content, status }`; `status` is `pending` \| `in_progress` \| `completed`) | Updated plan. |

<Note>
  `write_todos` has full-replace semantics: each call overwrites the entire list,
  so always send every todo. Keep exactly one `in_progress` while working, and
  mark items `completed` as you finish.
</Note>

## A note on hypothetical results

Any metrics these tools return — P\&L, win rate, drawdown, Sharpe — come from
a fixed, deterministic simulator over real historical prices, net of modeled
slippage and commission. The AI never invents them.

<Warning>
  Backtest and optimization results are **hypothetical and simulated**, not
  advice. Past performance does not guarantee future results. Always test before
  you trade.
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="Recipes" icon="book-open" href="/developers/recipes">
    Worked end-to-end flows that chain these tools together.
  </Card>

  <Card title="Developer concepts" icon="sitemap" href="/developers/concepts">
    Sessions, operations, status fields, and the async model.
  </Card>

  <Card title="Connect the MCP server" icon="plug" href="/developers/quickstart">
    Add AskFutures to Claude, Cursor, or Codex.
  </Card>

  <Card title="Authentication" icon="key" href="/developers/authentication">
    Get MCP access enabled and authorized.
  </Card>
</CardGroup>
