Skip to main content
Glama
svharivinod

TallyPrime MCP Server

by svharivinod

get_profit_loss

Retrieve a Profit and Loss statement from TallyPrime by providing start and end dates.

Instructions

Get the Profit and Loss statement from TallyPrime.

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
from_dateYes
to_dateYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'get_profit_loss'. It is an async function decorated with @mcp.tool() that takes from_date and to_date, calls client.get_profit_loss(), and returns the result as formatted JSON.
    @mcp.tool()
    async def get_profit_loss(from_date: str, to_date: str) -> str:
        """
        Get the Profit and Loss statement from TallyPrime.
    
        Args:
            from_date: Start date YYYYMMDD (e.g. '20250401').
            to_date: End date YYYYMMDD (e.g. '20260331').
        """
        try:
            data = await client.get_profit_loss(from_date, to_date)
            return f"Profit & Loss ({from_date} to {to_date}):\n\n" + json.dumps(data, indent=2)
        except TallyError as e:
            return f"Error: {e}"
  • Registration of all tool modules (including reports) onto the FastMCP server. The reports.register function registers 'get_profit_loss'.
    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_profit_loss() method that builds the XML via get_profit_loss_xml, sends it to TallyPrime, parses the response, and converts it to a dict.
    async def get_profit_loss(self, from_date: str, to_date: str) -> dict:
        from .xml_builder import get_profit_loss_xml
        return self._elem_to_dict(self._parse(await self.send_xml(get_profit_loss_xml(from_date, to_date))))
  • get_profit_loss_xml() builds the TDL XML request string for TallyPrime's 'Profit and Loss' report with from_date and to_date parameters.
    def get_profit_loss_xml(from_date: str, to_date: str) -> str:
        return f"""<ENVELOPE>
      <HEADER>
        <TALLYREQUEST>Export Data</TALLYREQUEST>
      </HEADER>
      <BODY>
        <EXPORTDATA>
          <REQUESTDESC>
            <REPORTNAME>Profit and Loss</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?

No annotations provided, and the description only says 'Get' implying read-only but lacks details on response format, limitations, or authentication needs.

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?

Short and clear, though could be more structured with separate sections.

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, but missing usage guidelines and behavioral transparency make it incomplete.

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

Parameters5/5

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

Schema has 0% description coverage, but the description adds date format (YYYYMMDD) and examples, significantly enhancing parameter understanding.

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 the tool gets the Profit and Loss statement from TallyPrime, specifying the resource and system, and distinguishes from sibling tools like get_balance_sheet.

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 on when to use this tool versus alternatives, no prerequisites or context 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