Skip to main content
Glama
svharivinod

TallyPrime MCP Server

by svharivinod

get_daybook

Retrieves all vouchers from TallyPrime Day Book for a specified date range. Input starting and ending dates in YYYYMMDD format.

Instructions

Get the Day Book (all vouchers) from TallyPrime for a date range.

Args: from_date: Start date YYYYMMDD. to_date: End date YYYYMMDD.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_dateYes
to_dateYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The get_daybook tool handler: fetches vouchers via client.get_vouchers(), formats them into a textual Day Book report string with date, type, number, amount, and narration.
    @mcp.tool()
    async def get_daybook(from_date: str, to_date: str) -> str:
        """
        Get the Day Book (all vouchers) from TallyPrime for a date range.
    
        Args:
            from_date: Start date YYYYMMDD.
            to_date: End date YYYYMMDD.
        """
        try:
            vouchers = await client.get_vouchers(from_date, to_date, voucher_type="")
            if not vouchers:
                return "No entries found in the Day Book for this period."
            text = f"Day Book ({from_date} to {to_date}) -- {len(vouchers)} entries:\n\n"
            for v in vouchers:
                text += (
                    f"  [{v['date']}]  {v['type']:<12}  #{v['number']:<10}"
                    f"  {v['amount']:>14}"
                    + (f"  {v['narration']}" if v["narration"] else "")
                    + "\n"
                )
            return text
        except TallyError as e:
            return f"Error: {e}"
  • Tool registration via @mcp.tool() decorator on the get_daybook function — the register() function in reports.py wires all report tools onto the MCP instance.
    @mcp.tool()
    async def get_stock_summary(as_of_date: str) -> str:
        """
        Get the Stock Summary (inventory) from TallyPrime as of a date.
    
        Args:
            as_of_date: Date YYYYMMDD (e.g. '20260516').
        """
        try:
            data = await client.get_stock_summary(as_of_date)
            return f"Stock Summary as of {as_of_date}:\n\n" + json.dumps(data, indent=2)
        except TallyError as e:
            return f"Error: {e}"
  • register_all() calls reports.register(mcp, client), which ultimately registers get_daybook as an 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.get_vouchers() — the helper method called by the get_daybook handler to fetch voucher data from Tally via XML, parsing DATE, VOUCHERTYPENAME, VOUCHERNUMBER, NARRATION, and AMOUNT fields.
    async def get_vouchers(self, from_date: str, to_date: str, voucher_type: str = "") -> list:
        from .xml_builder import get_vouchers_xml
        raw = await self.send_xml(get_vouchers_xml(from_date, to_date, voucher_type))
        root = self._parse(raw)
        return [{"date": (v.findtext("DATE") or "").strip(), "type": (v.findtext("VOUCHERTYPENAME") or "").strip(), "number": (v.findtext("VOUCHERNUMBER") or "").strip(), "narration": (v.findtext("NARRATION") or "").strip(), "amount": (v.findtext("AMOUNT") or "0").strip()} for v in root.iter("VOUCHER")]
  • get_vouchers_xml() builds the XML request using <REPORTNAME>Day Book</REPORTNAME> with SVFROMDATE/SVTODATE and optional VOUCHERTYPENAME filter — the actual XML sent to Tally to retrieve Day Book data.
    def get_vouchers_xml(from_date: str, to_date: str, voucher_type: str = "") -> str:
        """
        from_date / to_date: YYYYMMDD strings
        voucher_type: e.g. "Sales", "Purchase", "" for all
        """
        vtype_tag = f"<VOUCHERTYPENAME>{voucher_type}</VOUCHERTYPENAME>" if voucher_type else ""
        return f"""<ENVELOPE>
      <HEADER>
        <TALLYREQUEST>Export Data</TALLYREQUEST>
      </HEADER>
      <BODY>
        <EXPORTDATA>
          <REQUESTDESC>
            <REPORTNAME>Day Book</REPORTNAME>
            <STATICVARIABLES>
              <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
              <SVFROMDATE>{from_date}</SVFROMDATE>
              <SVTODATE>{to_date}</SVTODATE>
              {vtype_tag}
            </STATICVARIABLES>
          </REQUESTDESC>
        </EXPORTDATA>
      </BODY>
    </ENVELOPE>"""
Behavior2/5

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

No annotations exist, so description carries full burden. Only describes what it does, with no mention of safety (read-only), permissions, side effects, or return behavior. Lacks necessary behavioral context.

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?

Extremely concise: one sentence for purpose, two lines for args. No redundant information. Front-loaded with key action.

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

Completeness3/5

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

Output schema exists, so return values are covered. Low complexity tool, but missing usage guidelines and behavioral transparency. Adequate but with clear gaps.

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?

Schema coverage is 0%, but description includes useful param details (date format YYYYMMDD) for both parameters. Adds meaning beyond schema titles, fully compensating for coverage gap.

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?

Clearly states the tool retrieves the Day Book (all vouchers) from TallyPrime filtered by date range. Verb and resource are specific, and it distinguishes from sibling tools like get_vouchers.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implied usage (for date range), but no explicit guidance on when to prefer this over alternatives like get_vouchers or other get tools. No when-not-to-use or exclusions provided.

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