get_outstanding_receivables
Retrieve outstanding receivables from TallyPrime to see money owed by customers, with optional filters for date and specific party.
Instructions
Get outstanding receivables (money owed to you) from TallyPrime.
Args: as_of_date: Date YYYYMMDD. Defaults to today if not provided. party_name: Filter by a specific customer name (optional).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as_of_date | No | ||
| party_name | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- MCP tool handler: async function decorated with @mcp.tool() that accepts as_of_date and party_name, calls client.get_outstanding_receivables(), and returns JSON-formatted string.
@mcp.tool() async def get_outstanding_receivables(as_of_date: str = "", party_name: str = "") -> str: """ Get outstanding receivables (money owed to you) from TallyPrime. Args: as_of_date: Date YYYYMMDD. Defaults to today if not provided. party_name: Filter by a specific customer name (optional). """ try: if not as_of_date: as_of_date = _today() data = await client.get_outstanding_receivables(as_of_date, party_name) party_note = f" for '{party_name}'" if party_name else "" return f"Outstanding Receivables as of {as_of_date}{party_note}:\n\n" + json.dumps(data, indent=2) except TallyError as e: return f"Error: {e}" - Docstring serving as input schema: as_of_date (YYYYMMDD, optional, defaults to today) and party_name (customer filter, optional).
""" Get outstanding receivables (money owed to you) from TallyPrime. Args: as_of_date: Date YYYYMMDD. Defaults to today if not provided. party_name: Filter by a specific customer name (optional). - src/tallyprime_mcp/tools/__init__.py:7-11 (registration)Registration entry point: register_all() calls reports.register(mcp, client) which applies the @mcp.tool() decorator inside reports.py.
def register_all(mcp: FastMCP, client: TallyClient): company.register(mcp, client) ledgers.register(mcp, client) vouchers.register(mcp, client) reports.register(mcp, client) - src/tallyprime_mcp/tools/reports.py:11-12 (registration)The register() function wraps tool definitions with @mcp.tool() decorator, binding them to the FastMCP instance.
def register(mcp, client: TallyClient): - TallyClient method: builds XML via xml_builder, sends it to TallyPrime, parses response, and converts to dict.
async def get_outstanding_receivables(self, as_of_date: str, party_name: str = "") -> dict: from .xml_builder import get_outstanding_receivables_xml return self._elem_to_dict(self._parse(await self.send_xml(get_outstanding_receivables_xml(as_of_date, party_name)))) - XML builder: generates the TallyPrime XML envelope with REPORTNAME 'Bills Receivable', optional PARTYLEDGERNAME filter, and SVTODATE.
def get_outstanding_receivables_xml(as_of_date: str, party_name: str = "") -> str: party_tag = f"<PARTYLEDGERNAME>{party_name}</PARTYLEDGERNAME>" if party_name else "" return f"""<ENVELOPE> <HEADER> <TALLYREQUEST>Export Data</TALLYREQUEST> </HEADER> <BODY> <EXPORTDATA> <REQUESTDESC> <REPORTNAME>Bills Receivable</REPORTNAME> <STATICVARIABLES> <SVEXPORTFORMAT>$$SysName:XML</SVEXPORTFORMAT> <SVTODATE>{as_of_date}</SVTODATE> {party_tag} </STATICVARIABLES> </REQUESTDESC> </EXPORTDATA> </BODY> </ENVELOPE>"""