Skip to main content
Glama
Alexander-Panov

Finam MCP Server

order_cancel

Cancel an exchange order by providing the order ID to manage trading positions on Russian financial markets through the Finam trading platform.

Instructions

Отмена биржевой заявки

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
order_idYes

Implementation Reference

  • Handler function for the 'order_cancel' MCP tool (prefixed from 'cancel'), executes the order cancellation via the Finam client.
    @order_mcp.tool(tags={"order"}, meta={"sensitive": True}) async def cancel(order_id: str) -> OrderState: """Отмена биржевой заявки""" return await get_finam_client().cancel_order(order_id)
  • src/main.py:15-15 (registration)
    Registers the order_mcp tools with 'order' prefix, making 'cancel' available as 'order_cancel'.
    finam_mcp.mount(order_mcp, prefix="order")
  • Pydantic model for OrderState, used as the return type schema for the order_cancel tool.
    class OrderState(BaseModel): """Состояние заявки""" order_id: str = Field(..., description="Идентификатор заявки") exec_id: str | None = Field(None, description="Идентификатор исполнения") status: OrderStatus = Field(..., description="Статус заявки") order: Order = Field(..., description="Заявка") transact_at: datetime | None = Field(None, description="Дата и время выставления заявки") accept_at: datetime | None = Field(None, description="Дата и время принятия заявки") withdraw_at: datetime | None = Field(None, description="Дата и время отмены заявки")
  • Underlying API client method called by the handler to perform the order cancellation.
    async def cancel_order(self, order_id: str, account_id: str) -> OrderState: """Отмена биржевой заявки""" response, ok = await self._exec_request( self.RequestMethod.DELETE, self._url.format(account_id=account_id) + f"/{order_id}", ) if not ok: err = ErrorModel(**response) raise FinamTradeApiError(f"code={err.code} | message={err.message} | details={err.details}") return OrderState(**response)
  • Utility function to retrieve the FinamClient instance used in the handler.
    def get_finam_client() -> FinamClient: return get_context().get_state("finam_client")

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/Alexander-Panov/finam-mcp'

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