Skip to main content
Glama
svharivinod

TallyPrime MCP Server

by svharivinod

get_vouchers

Fetch vouchers from TallyPrime Day Book for a date range. Optionally filter by voucher type: Sales, Purchase, Payment, Receipt, Journal.

Instructions

Fetch vouchers from TallyPrime Day Book for a date range.

Args: from_date: Start date YYYYMMDD (e.g. '20250401'). to_date: End date YYYYMMDD (e.g. '20250430'). voucher_type: Filter — 'Sales', 'Purchase', 'Payment', 'Receipt', 'Journal'. Empty = all.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_dateYes
to_dateYes
voucher_typeNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'get_vouchers'. Decorated with @mcp.tool() inside the register() function. Delegates to client.get_vouchers() and formats the result as a human-readable string.
    @mcp.tool()
    async def get_vouchers(from_date: str, to_date: str, voucher_type: str = "") -> str:
        """
        Fetch vouchers from TallyPrime Day Book for a date range.
    
        Args:
            from_date: Start date YYYYMMDD (e.g. '20250401').
            to_date: End date YYYYMMDD (e.g. '20250430').
            voucher_type: Filter — 'Sales', 'Purchase', 'Payment', 'Receipt', 'Journal'. Empty = all.
        """
        try:
            vouchers = await client.get_vouchers(from_date, to_date, voucher_type)
            if not vouchers:
                return "No vouchers found for the given period."
            label = f" ({voucher_type})" if voucher_type else ""
            text = f"Found {len(vouchers)} vouchers{label} from {from_date} to {to_date}:\n\n"
            for v in vouchers:
                text += (
                    f"  [{v['date']}]  {v['type']}  #{v['number']}"
                    f"  Amount: {v['amount']}"
                    + (f"  -- {v['narration']}" if v["narration"] else "")
                    + "\n"
                )
            return text
        except TallyError as e:
            return f"Error: {e}"
  • Registration orchestration: register_all() calls vouchers.register(mcp, client), which is where the @mcp.tool() decorator registers 'get_vouchers'.
    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 async method that sends the XML request to TallyPrime and parses the response into a list of voucher dicts.
    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 TDL XML request string for fetching vouchers from the Day Book with date range and optional voucher type filter.
    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?

With no annotations, the description must disclose behavioral traits but only states 'Fetch vouchers' (implying read-only). It omits details on authentication, rate limits, pagination, result limits, or error handling, which are critical for a data fetching tool.

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 extremely concise: a single sentence stating purpose followed by a bulleted parameter list. Every element is necessary, and the format is front-loaded and easy to parse.

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 description covers purpose and parameter semantics adequately. Since an output schema exists, the lack of return value details is less critical. However, it could mention pagination or behavior for empty results. Overall, it is nearly complete for this moderate-complexity tool.

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?

The input schema has 0% description coverage, but the description compensates by explaining date formats (YYYYMMDD with examples) and voucher_type filter options (list of values, empty = all). This adds significant meaning beyond the schema's titles and default.

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 'Fetch vouchers from TallyPrime Day Book for a date range', specifying the verb (fetch), resource (vouchers), source (Day Book), and scope (date range). This distinguishes it from sibling tools like get_ledger or get_daybook, which focus on different data types.

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 like get_daybook or the create_* voucher tools. The description lacks when-not-to-use scenarios or comparisons, leaving the agent to infer context from sibling names alone.

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