Skip to main content
Glama
svharivinod

TallyPrime MCP Server

by svharivinod

get_active_company

Retrieve the name of the currently active company open in TallyPrime.

Instructions

Get the currently active company open in TallyPrime.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler function registered as @mcp.tool() which calls TallyClient.get_active_company() and returns the active company name.
    def register(mcp, client: TallyClient):
    
        @mcp.tool()
        async def get_active_company() -> str:
            """Get the currently active company open in TallyPrime."""
            try:
                result = await client.get_active_company()
                return f"Active company: {result['company']}"
            except TallyError as e:
                return f"Error: {e}"
  • The TallyClient method that sends a List of Accounts XML request and parses the <SVCURRENTCOMPANY> tag from the XML response to get the active company name.
    async def get_active_company(self) -> dict:
        import re
        from .xml_builder import get_all_ledgers_xml
        raw = await self.send_xml(get_all_ledgers_xml())
        match = re.search(r"<SVCURRENTCOMPANY>(.*?)</SVCURRENTCOMPANY>", raw)
        name = match.group(1).strip() if match else "Unknown"
        return {"company": name}
  • Builds the XML request payload for fetching the active company (List of Companies report).
    def get_active_company_xml() -> str:
        return """<ENVELOPE>
      <HEADER>
        <TALLYREQUEST>Export Data</TALLYREQUEST>
      </HEADER>
      <BODY>
        <EXPORTDATA>
          <REQUESTDESC>
            <REPORTNAME>List of Companies</REPORTNAME>
            <STATICVARIABLES>
              <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT>
            </STATICVARIABLES>
          </REQUESTDESC>
        </EXPORTDATA>
      </BODY>
    </ENVELOPE>"""
  • The register_all function that calls company.register(mcp, client) to register the get_active_company tool.
    def register_all(mcp: FastMCP, client: TallyClient):
        company.register(mcp, client)
        ledgers.register(mcp, client)
        vouchers.register(mcp, client)
        reports.register(mcp, client)
  • The server entry point that creates FastMCP instance and calls register_all to register all tools.
    mcp = FastMCP("tallyprime-mcp")
    
    _client = TallyClient(url=TALLY_URL, timeout=TALLY_TIMEOUT)
    register_all(mcp, _client)
    
    def main():
        mcp.run()
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It only states 'Get', implying read-only, but does not mention idempotency, authentication requirements, or any side effects. Minimal transparency.

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?

Single sentence, directly states purpose with no superfluous words. Front-loaded and efficient.

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

Completeness5/5

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

For a simple tool with no parameters and an output schema present, the description is sufficient. It tells the agent exactly what the tool does, and the output schema details the return structure.

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?

Zero parameters; baseline is 4. The description adds value by specifying that the tool retrieves the 'currently active company open in TallyPrime', clarifying what is returned beyond the empty schema.

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 specifies the verb 'Get' and the resource 'currently active company open in TallyPrime'. It uniquely identifies the tool's function among siblings, which focus on creating vouchers/ledgers or retrieving other data.

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. There is no mention of use cases, prerequisites, or exclusions. The agent must infer context from the name 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