Skip to main content
Glama

get_login_instructions

Retrieve browser-based login URL and instructions for DhanHQ trading API authentication. Complete the OAuth login manually by opening the provided URL.

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.

Input Schema

NameRequiredDescriptionDefault
consentAppIdNoThe consentAppId from Step 1 (start_authentication). If not provided, the latest one from the current session will be used.

Input Schema (JSON Schema)

{ "properties": { "consentAppId": { "description": "The consentAppId from Step 1 (start_authentication). If not provided, the latest one from the current session will be used.", "type": "string" } }, "required": [], "type": "object" }

Implementation Reference

  • MCP CallToolRequest handler case that implements the get_login_instructions tool. Handles input arguments, retrieves consentAppId from state if not provided, calls the helper function, and formats the response.
    case 'get_login_instructions': { console.error('[Tool] Executing: get_login_instructions'); const authState = getAuthState(); const consentAppId = (args as Record<string, unknown>).consentAppId || authState.consentAppId; if (!consentAppId) { throw new Error( 'No consentAppId available. Please run start_authentication first.' ); } const instructions = getStep2Instructions(consentAppId as string); return { content: [ { type: 'text' as const, text: JSON.stringify(instructions, null, 2), }, ], }; }
  • Tool metadata including name, description, and input schema definition used for tool discovery and validation.
    { name: 'get_login_instructions', description: '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.', inputSchema: { type: 'object' as const, properties: { consentAppId: { type: 'string' as const, description: 'The consentAppId from Step 1 (start_authentication). If not provided, the latest one from the current session will be used.', }, }, required: [], }, },
  • src/index.ts:359-361 (registration)
    Registers the tool list (including get_login_instructions) with the MCP server via ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools, }));
  • Helper function that constructs the login URL and multi-step instructions for browser-based authentication step 2.
    export function getStep2Instructions( consentAppId: string ): { loginUrl: string; instruction: string } { const loginUrl = `${AUTH_BASE_URL}/login/consentApp-login?consentAppId=${consentAppId}`; return { loginUrl, instruction: `1. Open this URL in your browser: ${loginUrl} 2. Log in with your Dhan credentials 3. Complete 2FA verification (OTP/PIN/Password) 4. You will be redirected to: ${dhanConfig.redirectUrl}?tokenId=<TOKEN_ID> 5. Copy the tokenId from the URL and use it in the 'consumeConsent' tool`, }; }

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