Skip to main content
Glama
svharivinod

TallyPrime MCP Server

by svharivinod

get_all_ledgers

Retrieve all ledgers from TallyPrime with their group and closing balance for financial analysis.

Instructions

Get all ledgers in TallyPrime with their group and closing balance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'get_all_ledgers'. Defines the async function that calls `client.get_all_ledgers()` and formats the result as a human-readable string.
    def register(mcp, client: TallyClient):
    
        @mcp.tool()
        async def get_all_ledgers() -> str:
            """Get all ledgers in TallyPrime with their group and closing balance."""
            try:
                ledgers = await client.get_all_ledgers()
                if not ledgers:
                    return "No ledgers found."
                text = f"Found {len(ledgers)} ledgers:\n\n"
                for l in ledgers:
                    text += f"  * {l['name']}  (Group: {l['group']},  Balance: {l['closing']})\n"
                return text
            except TallyError as e:
                return f"Error: {e}"
  • Tool registration via the `register()` function. Called by `register_all` in tools/__init__.py, which is invoked from both server.py and server_http.py.
    def register(mcp, client: TallyClient):
  • TallyClient.get_all_ledgers() — sends the XML request to TallyPrime and parses the response into a list of dicts with name, group, and closing balance.
    async def get_all_ledgers(self) -> list:
        from .xml_builder import get_all_ledgers_xml
        raw = await self.send_xml(get_all_ledgers_xml())
        root = self._parse(raw)
        return [{"name": (l.findtext("NAME") or l.get("NAME") or "").strip(), "group": (l.findtext("PARENT") or "").strip(), "closing": (l.findtext("CLOSINGBALANCE") or "0").strip()} for l in root.iter("LEDGER")]
  • get_all_ledgers_xml() — builds the Tally XML request string to export all ledgers (List of Accounts with ACCOUNTTYPE=Ledgers).
    def get_all_ledgers_xml() -> str:
        return """<ENVELOPE>
      <HEADER>
        <TALLYREQUEST>Export Data</TALLYREQUEST>
      </HEADER>
      <BODY>
        <EXPORTDATA>
          <REQUESTDESC>
            <REPORTNAME>List of Accounts</REPORTNAME>
            <STATICVARIABLES>
              <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
              <ACCOUNTTYPE>Ledgers</ACCOUNTTYPE>
            </STATICVARIABLES>
          </REQUESTDESC>
        </EXPORTDATA>
      </BODY>
    </ENVELOPE>"""
Behavior3/5

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

No annotations are given, so the description bears full responsibility for behavioral disclosure. It indicates the tool retrieves all ledgers, implying a read-only operation, but does not mention any behavioral traits such as performance implications, sorting, or pagination. It is adequate but minimal.

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 sentence that is concise, front-loaded, and contains no extraneous information. It efficiently communicates the tool's function without waste.

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 tool is a simple list retrieval with an output schema likely detailing the return structure. The description covers the key output fields (group and closing balance) and is suitable for a low-complexity tool. However, it could mention that the list is unfiltered or always returns all ledgers.

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?

There are no parameters in the input schema, so the description adds value by stating what will be returned (all ledgers with group and closing balance). The schema coverage is 100% (by default), and the description compensates by clarifying the output content.

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 uses the specific verb 'Get' and resource 'all ledgers', clearly stating the action and scope. It also specifies 'with their group and closing balance', adding detail that distinguishes it from siblings like 'get_ledger' (single ledger) and 'create_ledger' (create operation).

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 or when not to use it. For example, it does not mention that for a specific ledger, 'get_ledger' might be more appropriate, or that this tool returns all ledgers without filtering.

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