2727from schwab .orders .options import OptionSymbol
2828from schwab_mcp .context import SchwabContext , SchwabServerContext
2929from schwab_mcp .tools .registry import register
30- from schwab_mcp .tools .utils import call
30+ from schwab_mcp .tools .utils import JSONType , call
3131
3232
3333# Internal helper function to apply session and duration settings
@@ -170,7 +170,7 @@ async def get_order(
170170 ctx : SchwabContext ,
171171 account_hash : Annotated [str , "Account hash for the Schwab account" ],
172172 order_id : Annotated [str , "Order ID to get details for" ],
173- ) -> str :
173+ ) -> JSONType :
174174 """
175175 Returns details for a specific order (ID, status, price, quantity, execution details). Params: account_hash, order_id.
176176 """
@@ -195,7 +195,7 @@ async def get_orders(
195195 list [str ] | str | None ,
196196 "Filter by order status (e.g., WORKING, FILLED, CANCELED). See full list below." ,
197197 ] = None ,
198- ) -> str :
198+ ) -> JSONType :
199199 """
200200 Returns order history for an account. Filter by date range (max 60 days past) and status.
201201 Params: account_hash, max_results, from_date (YYYY-MM-DD), to_date (YYYY-MM-DD), status (list/str).
@@ -239,7 +239,7 @@ async def cancel_order(
239239 ctx : SchwabContext ,
240240 account_hash : Annotated [str , "Account hash for the Schwab account" ],
241241 order_id : Annotated [str , "Order ID to cancel" ],
242- ) -> str :
242+ ) -> JSONType :
243243 """
244244 Cancels a pending order. Cannot cancel executed/terminal orders. Params: account_hash, order_id. Returns cancellation request confirmation; check status after. *Write operation.*
245245 """
@@ -267,7 +267,7 @@ async def place_equity_order(
267267 str | None ,
268268 "Order duration: DAY (default), GOOD_TILL_CANCEL, FILL_OR_KILL (Limit/StopLimit only)" ,
269269 ] = "DAY" ,
270- ) -> str :
270+ ) -> JSONType :
271271 """
272272 Places a single equity order (MARKET, LIMIT, STOP, STOP_LIMIT).
273273 Params: account_hash, symbol, quantity, instruction (BUY/SELL), order_type.
@@ -315,7 +315,7 @@ async def place_option_order(
315315 str | None ,
316316 "Order duration: DAY (default), GOOD_TILL_CANCEL, FILL_OR_KILL (Limit only)" ,
317317 ] = "DAY" ,
318- ) -> str :
318+ ) -> JSONType :
319319 """
320320 Places a single option order (MARKET, LIMIT).
321321 Params: account_hash, symbol, quantity, instruction (BUY_TO_OPEN/etc.), order_type.
@@ -426,7 +426,7 @@ async def place_one_cancels_other_order(
426426 second_order_spec : Annotated [
427427 dict , "Second order specification (dict from build_equity/option_order_spec)"
428428 ],
429- ) -> str :
429+ ) -> JSONType :
430430 """
431431 Creates OCO order: execution of one cancels the other. Use for take-profit/stop-loss pairs.
432432 Params: account_hash, first_order_spec (dict), second_order_spec (dict).
@@ -460,7 +460,7 @@ async def place_first_triggers_second_order(
460460 dict ,
461461 "Second (triggered) order specification (dict from build_equity/option_order_spec)" ,
462462 ],
463- ) -> str :
463+ ) -> JSONType :
464464 """
465465 Creates conditional order: second order placed only after first executes. Use for activating exits after entry.
466466 Params: account_hash, first_order_spec (dict), second_order_spec (dict).
@@ -533,7 +533,7 @@ async def place_bracket_order(
533533 duration : Annotated [
534534 str | None , "Order duration: DAY (default), GOOD_TILL_CANCEL"
535535 ] = "DAY" ,
536- ) -> str :
536+ ) -> JSONType :
537537 """
538538 Creates a bracket order: entry + OCO take-profit/stop-loss. Exits trigger after entry executes.
539539 Params: account_hash, symbol, quantity, entry_instruction (BUY/SELL), entry_type (MARKET/LIMIT/STOP/STOP_LIMIT), profit_price, loss_price.
0 commit comments