Skip to main content
Glama

TradeStation MCP Server

by maven81g

getExecutions

Retrieve order execution details and fill information for specific trades placed through the TradeStation trading platform.

Instructions

Get fills/executions for a specific order

Input Schema

NameRequiredDescriptionDefault
accountIdNoAccount ID (optional, uses TRADESTATION_ACCOUNT_ID from env if not provided)
orderIdYesOrder ID

Input Schema (JSON Schema)

{ "properties": { "accountId": { "description": "Account ID (optional, uses TRADESTATION_ACCOUNT_ID from env if not provided)", "type": "string" }, "orderId": { "description": "Order ID", "type": "string" } }, "required": [ "orderId" ], "type": "object" }

Implementation Reference

  • Full implementation of the getExecutions tool handler, registered via server.tool. Fetches order executions from the TradeStation brokerage API endpoint `/brokerage/accounts/{accountId}/orders/{orderId}/executions` using the shared makeAuthenticatedRequest helper.
    server.tool( "getExecutions", "Get fills/executions for a specific order", executionsSchema, async (args) => { try { const accountId = args.accountId || TS_ACCOUNT_ID; const { orderId } = args; if (!accountId) { throw new Error('Account ID is required. Either provide accountId parameter or set TRADESTATION_ACCOUNT_ID in .env file.'); } const executions = await makeAuthenticatedRequest( `/brokerage/accounts/${encodeURIComponent(accountId)}/orders/${encodeURIComponent(orderId)}/executions` ); return { content: [ { type: "text", text: JSON.stringify(executions, null, 2) } ] }; } catch (error: unknown) { return { content: [ { type: "text", text: `Failed to fetch executions: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } );
  • Zod schema defining input parameters for the getExecutions tool: optional accountId and required orderId.
    const executionsSchema = { accountId: z.string().optional().describe('Account ID (optional, uses TRADESTATION_ACCOUNT_ID from env if not provided)'), orderId: z.string().describe('Order ID') };
  • src/index.ts:629-666 (registration)
    Registration of the getExecutions tool on the MCP server using server.tool method, specifying name, description, input schema, and handler function.
    server.tool( "getExecutions", "Get fills/executions for a specific order", executionsSchema, async (args) => { try { const accountId = args.accountId || TS_ACCOUNT_ID; const { orderId } = args; if (!accountId) { throw new Error('Account ID is required. Either provide accountId parameter or set TRADESTATION_ACCOUNT_ID in .env file.'); } const executions = await makeAuthenticatedRequest( `/brokerage/accounts/${encodeURIComponent(accountId)}/orders/${encodeURIComponent(orderId)}/executions` ); return { content: [ { type: "text", text: JSON.stringify(executions, null, 2) } ] }; } catch (error: unknown) { return { content: [ { type: "text", text: `Failed to fetch executions: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } );

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/maven81g/tradestation_mcp'

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