Skip to main content
Glama

get_fund_limit

Retrieve account fund limits including available balance, margins, collateral, and withdrawable amounts for trading operations on DhanHQ.

Instructions

Retrieves account fund limit information including available balance, margins, collateral, and withdrawable balance. Requires authentication.

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

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

Implementation Reference

  • Core handler function that executes the get_fund_limit tool logic by calling the Dhan API to retrieve account fund limits using the current access token.
    export async function getFundLimit(): Promise<FundLimit> { try { const accessToken = getAccessToken(); if (!accessToken) { throw new Error('No valid access token. Please authenticate first.'); } log('Fetching fund limit...'); const response = await axios.get<FundLimit>( 'https://api.dhan.co/v2/fundlimit', { headers: { 'Content-Type': 'application/json', 'access-token': accessToken, }, } ); log(`✓ Fund limit retrieved for client ${response.data.dhanClientId}`); log(`Available Balance: ${response.data.availabelBalance}`); 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 fund limit: ${errorMessage}`); throw new Error(`Failed to get fund limit: ${errorMessage}`); } }
  • MCP tool schema registration defining the name, description, and input schema (no parameters required) for the get_fund_limit tool.
    name: 'get_fund_limit', description: 'Retrieves account fund limit information including available balance, margins, collateral, and withdrawable balance. Requires authentication.', inputSchema: { type: 'object' as const, properties: {}, required: [], }, },
  • src/index.ts:491-502 (registration)
    Tool dispatch/registration in the MCP callTool handler switch statement, which invokes the getFundLimit function and formats the response.
    case 'get_fund_limit': { console.error('[Tool] Executing: get_fund_limit'); const fundLimit = await getFundLimit(); return { content: [ { type: 'text' as const, text: JSON.stringify(fundLimit, null, 2), }, ], }; }
  • TypeScript interface defining the structure of the FundLimit response object used by the getFundLimit handler.
    export interface FundLimit { dhanClientId: string; availabelBalance: number; sodLimit: number; collateralAmount: number; receiveableAmount: number; utilizedAmount: number; blockedPayoutAmount: number; withdrawableBalance: number; }

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