Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| DHAN_API_KEY | Yes | Your DhanHQ API key (valid for 12 months) | |
| REDIRECT_URL | Yes | The redirect URL configured in your DhanHQ API settings | http://localhost:3000/callback |
| DHAN_CLIENT_ID | Yes | Your DhanHQ client ID | |
| DHAN_API_SECRET | Yes | Your DhanHQ API secret (valid for 12 months) |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| start_authentication | Initiates the DhanHQ authentication flow (Step 1). Returns a login URL that you must open in your browser to authenticate. |
| get_login_instructions | Gets the login instructions and URL for Step 2 (browser-based login). You must complete this step manually by opening the URL in your browser. |
| complete_authentication | Completes the authentication flow (Step 3). Takes the tokenId from the redirect URL after browser login and exchanges it for an access token. |
| check_auth_status | Checks the current authentication status and returns details about the active access token if available. |
| reset_authentication | Clears the current authentication state and resets the session. |
| get_fund_limit | Retrieves account fund limit information including available balance, margins, collateral, and withdrawable balance. Requires authentication. |
| place_order | Places a new order on DhanHQ. Requires authentication. Supports MARKET, LIMIT, STOP_LOSS, and STOP_LOSS_MARKET orders. |
| modify_order | Modifies a pending order. Can change price, quantity, order type, and other parameters. Requires authentication. |
| cancel_order | Cancels a pending order. Requires authentication and a valid order ID. |
| get_order_book | Retrieves all orders placed during the day with their current status. Requires authentication. |
| get_order_by_id | Retrieves the details and status of a specific order by order ID. Requires authentication. |
| get_order_by_correlation_id | Retrieves order status using the user-specified correlation ID. Requires authentication. |
| get_trade_book | Retrieves all trades executed during the day. Useful for tracking fills and execution prices. Requires authentication. |
| get_order_trades | Retrieves all trades for a specific order. Useful for partial fills or bracket/cover orders. Requires authentication. |
| place_super_order | Places a smart super order combining entry, target, and stop-loss legs. Supports trailing stop loss. Requires authentication. |
| modify_super_order | Modifies any leg of a pending or part-traded super order. Requires authentication. |
| cancel_super_order_leg | Cancels a specific leg of a super order (ENTRY_LEG, TARGET_LEG, or STOP_LOSS_LEG). Requires authentication. |
| get_super_order_book | Retrieves all super orders placed during the day with nested leg details. Requires authentication. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |