Skip to main content
Glama
yogendhra9

Zerodha Trading Bot

by yogendhra9

Generate-Session

Create a session token from a request token to authenticate automated trading operations on the Zerodha platform.

Instructions

Generate a new session token using request token

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
requestTokenYes

Implementation Reference

  • index.js:50-64 (registration)
    Registration of the 'Generate-Session' MCP tool, including name, description, input schema {requestToken: z.string()}, and inline handler function.
    server.tool(
      "Generate-Session",
      "Generate a new session token using request token",
      { requestToken: z.string() },
      async ({ requestToken }) => {
        try {
          const response = await tokenManager.generateSession(requestToken);
          return {
            content: [{ type: "text", text: "Session generated successfully" }],
          };
        } catch (error) {
          return { content: [{ type: "text", text: `Error: ${error.message}` }] };
        }
      }
    );
  • index.js:54-63 (handler)
    Inline handler for the Generate-Session tool that invokes tokenManager.generateSession(requestToken) and formats the MCP response.
    async ({ requestToken }) => {
      try {
        const response = await tokenManager.generateSession(requestToken);
        return {
          content: [{ type: "text", text: "Session generated successfully" }],
        };
      } catch (error) {
        return { content: [{ type: "text", text: `Error: ${error.message}` }] };
      }
    }
  • TokenManager.generateSession method: core logic using KiteConnect to generate session token from requestToken and apiSecret, saves token to file, returns response.
    async generateSession(requestToken) {
      try {
        const response = await this.kc.generateSession(
          requestToken,
          this.apiSecret
        );
        await this.saveToken(response);
        return response;
      } catch (error) {
        throw new Error(`Error generating session: ${error.message}`);
      }
    }
Behavior2/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 states the tool generates a session token, implying a write operation that creates new data, but doesn't disclose behavioral traits like authentication requirements, rate limits, token expiration, or side effects. This is a significant gap for a tool that likely involves security-sensitive operations.

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 a single, efficient sentence: 'Generate a new session token using request token'. It is front-loaded with the core action and resource, with zero wasted words. Every part of the sentence contributes to understanding the tool's basic function.

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

Completeness2/5

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

Given the complexity (authentication/token generation tool), lack of annotations, no output schema, and low schema coverage, the description is incomplete. It doesn't explain what a session token is used for, the response format, error conditions, or security implications. For such a tool, more context is needed to guide safe and effective usage.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate. It mentions 'request token' as the input, which aligns with the single parameter 'requestToken', but adds no meaning beyond the schema's type and requirement. It doesn't explain what a request token is, how to obtain it, or its format, leaving the parameter semantics unclear.

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 tool's purpose: 'Generate a new session token using request token'. It specifies the verb ('Generate') and resource ('session token'), and mentions the required input ('request token'). However, it doesn't differentiate from sibling tools, which are unrelated (e.g., Buy-Stock, factorial), so it doesn't need sibling differentiation.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a request token first), context for usage, or exclusions. Without annotations or sibling tools for authentication, the agent has no hints about usage scenarios.

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/yogendhra9/ZerodhaMCP'

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