Skip to main content
Glama

get_super_order_book

Retrieve all super orders placed during the day with nested leg details to manage trading operations through DhanHQ trading APIs.

Instructions

Retrieves all super orders placed during the day with nested leg details. Requires authentication.

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "required": [], "type": "object" }

Implementation Reference

  • The core handler function that performs the HTTP GET request to the Dhan API endpoint 'https://api.dhan.co/v2/super/orders' to retrieve the list of super orders, using the authenticated access token via getApiHeaders().
    export async function getSuperOrderBook(): Promise<SuperOrderBook[]> { try { log('Fetching super order book...'); const response = await axios.get<SuperOrderBook[]>( 'https://api.dhan.co/v2/super/orders', { headers: getApiHeaders(), } ); log(`✓ Super order book retrieved. Total super orders: ${response.data.length}`); return response.data; } catch (error) { const errorMessage = error instanceof axios.AxiosError ? `API Error: ${error.response?.status} - ${JSON.stringify(error.response?.data)}` : error instanceof Error ? error.message : 'Unknown error'; log(`✗ Failed to get super order book: ${errorMessage}`); throw new Error(`Failed to get super order book: ${errorMessage}`); } }
  • MCP tool schema definition specifying the tool name, description, and input schema (no required parameters). This is used in the listTools response.
    { name: 'get_super_order_book', description: 'Retrieves all super orders placed during the day with nested leg details. Requires authentication.', inputSchema: { type: 'object' as const, properties: {}, required: [], }, },
  • src/index.ts:703-714 (registration)
    Registration in the MCP CallToolRequestSchema handler: switch case that dispatches to the getSuperOrderBook() function and formats the response as MCP content.
    case 'get_super_order_book': { console.error('[Tool] Executing: get_super_order_book'); const superOrders = await getSuperOrderBook(); return { content: [ { type: 'text' as const, text: JSON.stringify(superOrders, null, 2), }, ], }; }
  • TypeScript interface defining the structure of a SuperOrderBook entry, used as the return type for getSuperOrderBook() and API response typing.
    export interface SuperOrderBook { dhanClientId: string; orderId: string; correlationId: string; orderStatus: string; legName: 'ENTRY_LEG' | 'TARGET_LEG' | 'STOP_LOSS_LEG'; quantity: number; price: number; exchangeSegment: string; productType: string; orderType: string; transactionType: string; legDetails?: SuperOrderLeg[]; }

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/harshitdynamite/DhanMCP'

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