MTContext Docs
Tool Reference

Lease

3 tools in this category.

Overview

Lease includes 3 tools for this workflow area.

Available tools: acquire_lease, get_leases, release_lease.

Use the parameter tables and examples below as the canonical request contract.

acquire_lease

Claims a ticket or a symbol for a limited time so other agents cannot modify, close or trade it while you work. resource is "ticket:<n>" (one position or pending order) or "symbol:<SYM>" (every position and new order on that symbol, e.g. "symbol:EURUSD"; use the broker's exact symbol name, case does not matter). owner names you (e.g. "risk", "position_manager"). ttl_sec is how long the claim lasts, 1 to 3600 seconds; it expires by itself.

Returns lease_token and expires_at (UTC). Keep the token: pass it as lease_token on modify_position, close_position, partial_close, set_breakeven, set_trailing_stop, reverse_position, cancel_order, modify_pending_order, place_order or close_all_positions to act on what you hold. Any call on that resource without the token is refused with code LEASED and current_state {resource, holder, expires_at}. The token is returned only here; it cannot be looked up later, so release_lease needs it. If the resource is already leased this returns LEASED naming the holder and expiry, and you cannot re-acquire your own lease without its token — release it first or wait for expiry.

Leases are per terminal and last across a restart. Read-only tools are never blocked. Emergency closes by a call with owner "guardian" and override=true on close_position / close_all_positions go through a lease, but nothing else does; every such override is journalled. Requires the trade capability. dry_run=true (default false here, because a lease that was never taken protects nothing) reports whether the claim would succeed without taking it.

This tool can affect a live trading account. dry_run defaults to true — pass dry_run: false explicitly to execute for real.

Parameters

NameTypeRequiredDefaultDescription
resourcestringYes——
ownerstringYes——
ttl_secintegerYes——
dry_runbooleanNofalse—

Example Request

{
  "tool": "acquire_lease",
  "arguments": {
    "resource": "resource_value",
    "owner": "owner_value",
    "ttl_sec": 1,
    "dry_run": false
  }
}

Usage Notes

  • Keep dry_run: true until you have validated symbol, lot size, and expected execution behavior.

get_leases

Lists the active leases on this terminal, soonest-expiring first: resource, owner, acquired_at and expires_at (UTC ISO times). Tokens are never shown. Use it to see who is working on what before acting, and to find out how long a LEASED refusal will last. Expired leases are not listed. Requires the read capability.

Parameters

No parameters.

Example Request

{
  "tool": "get_leases",
  "arguments": {}
}

release_lease

Gives a lease back before it expires, using the lease_token that acquire_lease returned. Returns {released: true}. NOT_FOUND means there is no active lease on that resource (already released or expired). LEASED means the token does not match the holder, and nothing was released. Requires the trade capability. dry_run=true (default false) only confirms a lease exists.

This tool can affect a live trading account. dry_run defaults to true — pass dry_run: false explicitly to execute for real.

Parameters

NameTypeRequiredDefaultDescription
resourcestringYes——
lease_tokenstringYes——
dry_runbooleanNofalse—

Example Request

{
  "tool": "release_lease",
  "arguments": {
    "resource": "resource_value",
    "lease_token": "lease_token_value",
    "dry_run": false
  }
}

Usage Notes

  • Keep dry_run: true until you have validated symbol, lot size, and expected execution behavior.

On this page