Skip to main content
Glama
ERPNext MCP Server

ERPNext MCP Server

by hatlabs

get_document

Retrieve a single ERPNext document by DocType and name, including child tables, while stripping system metadata and null fields; use fields and child_fields to return only needed data.

Instructions

Get a single document by DocType and name, including child tables. Response is automatically stripped of system metadata and null/default fields. Use 'fields' to select specific top-level fields, and 'child_fields' to select fields within child tables. 'name', 'docstatus', and 'status' are always included.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "doctype": "<doctype>",
      "name": "<name>"
    },
    "name": "get_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
nameYesDocument name/ID (e.g., BOM-COM-HALPI2-007)
fieldsNoTop-level fields to include (e.g., ["item", "total_cost", "items"]). Child tables are included by fieldname. If omitted, all fields are returned (with system fields stripped). 'name' and 'docstatus' are always included.
doctypeYesERPNext DocType (e.g., Customer, Item)
child_fieldsNoFields to include per child table, keyed by table fieldname (e.g., {"items": ["item_code", "qty", "rate"]}). If a child table is not listed here, all its fields are returned (stripped). 'name' (row ID) is always included.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.8/5.0
Behavior4/5

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

With no annotations provided, the description carries the burden and does disclose real behavior: system metadata and null/default fields are stripped from the response, and name/docstatus/status are guaranteed present. It does not state that this is a read-only operation, what happens when the document does not exist, or any permission requirements.

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?

Four sentences, front-loaded with the operation and scope, then the response-shaping behavior, then parameter hints. Nothing is padded and the ordering follows how an agent would reason about the call.

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?

With no output schema and no annotations, the description does enough for a simple read: it explains response stripping and guaranteed fields, plus how to narrow fields and child fields. Error behavior and access requirements are the remaining gaps, which are minor for this tool's complexity.

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?

Schema description coverage is 100%, so the schema already documents doctype, name, fields, and child_fields in detail. The description mostly restates that contract, adding only the note that 'status' is always included, which the schema omits; that is a marginal gain over the structured field docs.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: fetch one document identified by DocType plus name, explicitly including child tables. The word 'single' implicitly contrasts with the plural retrieval sibling get_documents, but the routing is left implicit rather than stated.

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

Usage Guidelines3/5

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

Usage is only implied by the purpose line; there is no explicit 'use this when' or 'use X instead' guidance. An agent must infer that get_documents covers multi-record retrieval and get_child_documents covers the child-table-only case, and no prerequisites (permissions, existence checks) are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.