Skip to main content
Glama
svharivinod

TallyPrime MCP Server

by svharivinod

get_trial_balance

Retrieves the Trial Balance from TallyPrime for a specified date range, summarizing account balances.

Instructions

Get the Trial Balance from TallyPrime.

Args: from_date: Start date YYYYMMDD (e.g. '20250401'). to_date: End date YYYYMMDD (e.g. '20250930').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_dateYes
to_dateYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler: the 'get_trial_balance' async function decorated with @mcp.tool(). Receives from_date/to_date, calls client.get_trial_balance(), and returns JSON-formatted string.
    async def get_trial_balance(from_date: str, to_date: str) -> str:
        """
        Get the Trial Balance from TallyPrime.
    
        Args:
            from_date: Start date YYYYMMDD (e.g. '20250401').
            to_date: End date YYYYMMDD (e.g. '20250930').
        """
        try:
            data = await client.get_trial_balance(from_date, to_date)
            return f"Trial Balance ({from_date} to {to_date}):\n\n" + json.dumps(data, indent=2)
        except TallyError as e:
            return f"Error: {e}"
  • Tool registration: register_all() calls reports.register(mcp, client) which decorates the get_trial_balance function with @mcp.tool().
    def register_all(mcp: FastMCP, client: TallyClient):
        company.register(mcp, client)
        ledgers.register(mcp, client)
        vouchers.register(mcp, client)
        reports.register(mcp, client)
  • TallyClient method: get_trial_balance() sends the XML request to TallyPrime and converts the response to a dict using _elem_to_dict().
    async def get_trial_balance(self, from_date: str, to_date: str) -> dict:
        from .xml_builder import get_trial_balance_xml
        return self._elem_to_dict(self._parse(await self.send_xml(get_trial_balance_xml(from_date, to_date))))
  • XML builder: get_trial_balance_xml() constructs the TDL XML request string with REPORTNAME 'Trial Balance' and date range parameters.
    def get_trial_balance_xml(from_date: str, to_date: str) -> str:
        return f"""<ENVELOPE>
      <HEADER>
        <TALLYREQUEST>Export Data</TALLYREQUEST>
      </HEADER>
      <BODY>
        <EXPORTDATA>
          <REQUESTDESC>
            <REPORTNAME>Trial Balance</REPORTNAME>
            <STATICVARIABLES>
              <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
              <SVFROMDATE>{from_date}</SVFROMDATE>
              <SVTODATE>{to_date}</SVTODATE>
            </STATICVARIABLES>
          </REQUESTDESC>
        </EXPORTDATA>
      </BODY>
    </ENVELOPE>"""
Behavior2/5

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

With no annotations, the description carries full burden. It only states the purpose without disclosing behavior such as read-only nature, data freshness, or any side effects. Minimal value added beyond the tool name.

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

Conciseness4/5

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

The description is short and includes parameter documentation in a clear docstring format. However, it could be slightly more structured (e.g., separate sections). No wasted sentences.

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

Completeness4/5

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

The output schema exists, so return values need not be described. The description covers both required parameters with format examples. It is sufficient for a simple retrieval tool, though lacks context on what the trial balance report contains.

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?

Although the schema has 0% description coverage, the description explicitly documents both parameters with format examples (YYYYMMDD), adding meaning beyond the schema properties which only have titles.

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

Purpose5/5

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

The description clearly states 'Get the Trial Balance from TallyPrime', with a specific verb and resource. This distinguishes it from sibling tools like get_balance_sheet and get_profit_loss, which produce different financial reports.

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?

No guidance is provided on when to use this tool versus alternatives (e.g., get_balance_sheet). There is no mention of prerequisites, context, or when not to use it.

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/svharivinod/tallyprime-mcp'

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