Skip to main content
Glama
lokesh-sparrow

PNPC-MCP-Tally-Prime

query_sql

Read-only

Run read-only SQL SELECT queries against cached Tally data tables to analyze voucher items, stock, balances, and report snapshots without re-fetching from Tally.

Instructions

Run a read-only SQL SELECT query against this session's in-memory cache (gone when the session ends). Tables: ledgers(name, parent, closing_balance, trn, state, country), groups(name, parent), stock_items(name, parent, closing_balance), vouchers(guid, date, voucher_type, voucher_number, party_ledger, amount, narration), voucher_items(voucher_guid, date, voucher_type, voucher_number, stock_item, qty, rate, amount, is_deemed_positive, godown, batch) — all five populated only by explicitly calling sync_to_sql/sync_vouchers_to_sql/sync_voucher_items_to_sql first. Movement analysis, godown-wise stock, and batch/ageing detail are just SELECTs over voucher_items — there is no separate report tool for them. profit_and_loss(ledger_name, group_name, closing_balance, period_from, period_to), stock_summary(name, parent, opening_qty, closing_qty, opening_value, closing_value, as_of_date), balance_sheet(group_name, amount, as_of_date), trial_balance(name, debit_amount, credit_amount, period_from, period_to), and vat_summary(ledger_name, category, closing_balance, period_from, period_to) are populated automatically, no separate sync step — every get_profit_and_loss/get_stock_summary/get_balance_sheet/get_trial_balance/get_vat_liability_summary call refreshes its table with that call's result, so a follow-up question about the same report can query it here instead of re-fetching from Tally. Each of these five only ever holds the most recent call's data, not a history — re-call the report tool if you need a different period. set_company automatically empties every one of these tables when the active company changes, so a query never silently returns a previous company's rows — it just means every table is empty again right after switching, until re-synced/re-fetched.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYesA single SELECT statement

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv1.0.3

TDQS

A4.6/5.0
Behavior5/5

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

The description goes far beyond the readOnlyHint annotation: it warns the cache is session-scoped and disappears when the session ends, reports that sync tables are only populated by explicit sync calls, and discloses that set_company empties every SQL table when the active company changes. This prevents an agent from silently querying stale or cross-company rows. The readOnlyHint=true annotation is consistent with the read-only SELECT description.

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?

The description is dense but front-loaded with the most important behavior: read-only, in-memory cache. Each clause about table population and lifecycle earns its place, though the long table-schema listing and the trailing set_company detail make it longer than strictly minimal. It is informative without being padded.

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 query tool with one parameter and no output schema, the description covers the full lifecycle: what is in the cache, how each table gets populated, which data can be derived without a separate report tool, and what invalidates the data. The agent has enough context to decide when to call it, what to run, and what to expect after session/company changes.

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

Parameters3/5

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

The input schema already fully documents the single 'sql' parameter as 'A single SELECT statement' (100% schema description coverage). The description adds useful table context but does not add much parameter-level semantic detail such as syntax restrictions, limits, or examples. Baseline 3 is appropriate because the schema carries the parameter-documentation burden.

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 opens with a crisp specific action — 'Run a read-only SQL SELECT query against this session's in-memory cache' — and immediately distinguishes it from the report getter siblings. Listing the exact tables and how they are populated removes ambiguity about what this tool can query.

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

Usage Guidelines5/5

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

The description explicitly explains when to use query_sql vs the domain get_* report tools: after a report call, a follow-up question can query the refreshed table here instead of re-fetching from Tally. It also tells the agent when NOT to rely on it — the five report tables only hold the most recent call's data, and re-calling the report tool is needed for a different period. This is strong routing guidance.

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/lokesh-sparrow/PNPC-MCP-Tally-Prime'

If you have feedback or need assistance with the MCP directory API, please join our Discord server