Skip to main content
Glama
harshitdynamite

DhanHQ MCP Server

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

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

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[];
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses the authentication requirement, which is useful behavioral context. However, it lacks details on rate limits, pagination, error handling, or what 'during the day' means (e.g., timezone, date range). This leaves gaps in behavioral understanding.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences that efficiently convey the purpose and a key requirement. It is front-loaded with the main action and avoids unnecessary words, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 0 parameters, the description is minimal but covers the basic purpose and authentication need. However, for a tool that retrieves data (implied read operation), it lacks details on return format, scope limitations, or error cases, making it incomplete for full contextual understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, but since there are no parameters, this is acceptable. Baseline for 0 parameters is 4, as it doesn't need to compensate for missing schema info.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Retrieves') and resource ('all super orders placed during the day with nested leg details'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_order_book' or 'get_super_order' (if that were a sibling), which would require a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions 'Requires authentication,' which provides some context for usage prerequisites, but it doesn't specify when to use this tool versus alternatives like 'get_order_book' or 'get_super_order' (if applicable). No explicit guidance on when-not-to-use or comparisons is given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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