Skip to main content
Glama
Frappe MCP Server

Frappe MCP Server

Search or list documents

frappe_search_docs
Read-onlyIdempotent

Search or list documents of a single DocType with filters, selected fields, ordering, and pagination to find records by field value or browse matching entries.

Instructions

Search or list documents of one DocType, with optional filters, field selection, ordering and pagination. Use to find documents by field value or to browse a DocType. Use frappe_get_doc instead when the exact document name is known and every field is wanted; use frappe_run_method for aggregates, totals or report output, which this tool cannot compute. Behavior: read-only and idempotent, with no side effects. Only documents the API user's role permissions allow are returned, so a short result may mean restricted access rather than no matches. An unknown doctype raises a not-found error, and an unknown fieldname in filters, fields or order_by raises a Frappe error rather than being silently ignored. Parameters: filters entries are ANDed together — there is no OR — and each is a [field, operator, value] triple; in/not in take a list as the value and between takes a two-element list. fields should name only what is needed, since omitting it returns every field of every row and can be very large. limit defaults to 20 and Frappe caps it at 200; there is no offset parameter, so page by ordering on creation and filtering past the last value already seen. Returns: {"data": [...]} — an array of documents, empty when nothing matches.

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": "frappe_search_docs"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum number of results to return (default: 20, maximum: 200). Frappe caps results at 200 per request; there is no offset parameter, so paginate by narrowing `filters` rather than by increasing this.
fieldsNoOptional list of fieldnames to return. Limits the response to only the specified fields, which keeps large result sets manageable. Example: ['name', 'status', 'grand_total', 'posting_date']. When omitted, all fields are returned. Child-table fields are not expanded here — fetch the full document with frappe_get_doc for those.
doctypeYesThe DocType to search within (e.g. 'Sales Invoice', 'Customer', 'Item', 'ToDo', 'Contact'). Case-sensitive; exactly one DocType per call, as this tool cannot search across DocTypes.
filtersNoOptional list of filter conditions, all ANDed together. Each filter is a triple [field, operator, value]. Supported operators: =, !=, >, <, >=, <=, like, not like, in, not in, between. Example: [['status','=','Open'], ['grand_total','>','1000']]. Dates are compared as 'YYYY-MM-DD' strings.
order_byNoField to sort by with direction, formatted as 'fieldname direction'. Examples: 'creation desc' (newest first), 'modified asc' (oldest updated first), 'name asc' (alphabetical). The direction is required. Defaults to 'creation desc' when omitted.

Output Schema

NameRequiredDescriptionDefault
dataYesMatching documents, in the requested order. Empty when nothing matched. Each row carries only the requested `fields`, or every field when `fields` was omitted.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv1.2.0
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / doctype / description
      Previous value: -"The DocType to search within (e.g. 'Sales Invoice', 'Customer', 'Item', 'ToDo', 'Contact'). This parameter is required."New value: +"The DocType to search within (e.g. 'Sales Invoice', 'Customer', 'Item', 'ToDo', 'Contact'). Case-sensitive; exactly one DocType per call, as this tool cannot search across DocTypes."
    • addedInput schema / properties / doctype / minLength
      Added value: +1
    • changedInput schema / properties / fields / description
      Previous value: -"Optional list of field names to return. Limits the response to only the specified fields for efficiency. Example: ['name', 'status', 'grand_total', 'posting_date']. When omitted, all fields are returned."New value: +"Optional list of fieldnames to return. Limits the response to only the specified fields, which keeps large result sets manageable. Example: ['name', 'status', 'grand_total', 'posting_date']. When omitted, all fields are returned. Child-table fields are not expanded here — fetch the full document with frappe_get_doc for those."
    • changedInput schema / properties / filters / description
      Previous value: -"Optional list of filter conditions. Each filter is a triple [field, operator, value]. Supported operators: =, !=, >, <, >=, <=, like, not like, in, not in, between. Example: [['status','=','Open'], ['grand_total','>','1000']]."New value: +"Optional list of filter conditions, all ANDed together. Each filter is a triple [field, operator, value]. Supported operators: =, !=, >, <, >=, <=, like, not like, in, not in, between. Example: [['status','=','Open'], ['grand_total','>','1000']]. Dates are compared as 'YYYY-MM-DD' strings."
    • changedInput schema / properties / filters / items / prefixItems
      Previous value: -[
      -  {
      -    "description": "Field name to filter on",
      -    "type": "string"
      -  },
      -  {
      -    "description": "Operator: =, !=, >, <, >=, <=, like, not like, in, not in, between",
      -    "type": "string"
      -  },
      -  {
      -    "description": "Value to compare against",
      -    "type": "string"
      -  }
      -]New value: +[
      +  {
      +    "description": "Fieldname to filter on — the DocType's fieldname (e.g. 'grand_total'), not its form label.",
      +    "type": "string"
      +  },
      +  {
      +    "description": "Operator: =, !=, >, <, >=, <=, like, not like, in, not in, between",
      +    "type": "string"
      +  },
      +  {
      +    "description": "Value to compare against. Use % as the wildcard with 'like'; pass a list for 'in'/'not in' and a two-element list for 'between'.",
      +    "type": "string"
      +  }
      +]
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum number of results to return (default: 20, maximum: 200). Use for pagination. Frappe caps results at 200 per request."New value: +"Maximum number of results to return (default: 20, maximum: 200). Frappe caps results at 200 per request; there is no offset parameter, so paginate by narrowing `filters` rather than by increasing this."
    • changedInput schema / properties / order_by / description
      Previous value: -"Field to sort by with direction. Format: 'fieldname direction'. Examples: 'creation desc' (newest first), 'modified asc' (oldest updated first), 'name asc' (alphabetical). Default ordering is by creation date descending."New value: +"Field to sort by with direction, formatted as 'fieldname direction'. Examples: 'creation desc' (newest first), 'modified asc' (oldest updated first), 'name asc' (alphabetical). The direction is required. Defaults to 'creation desc' when omitted."
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "data": {
      +      "description": "Matching documents, in the requested order. Empty when nothing matched. Each row carries only the requested `fields`, or every field when `fields` was omitted.",
      +      "items": {
      +        "additionalProperties": true,
      +        "description": "A Frappe document. Keys are DocType fieldnames; child tables appear as arrays of row objects. Always includes `name` (the primary key), `owner`, `creation`, `modified` and `docstatus` (0 = draft, 1 = submitted, 2 = cancelled).",
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "data"
      +  ],
      +  "type": "object"
      +}
  2. Changed13 schema fields changedv1.1.0
    • changedInput schema / properties / doctype / description
      Previous value: -"The DocType to search."New value: +"The DocType to search within (e.g. 'Sales Invoice', 'Customer', 'Item', 'ToDo', 'Contact'). This parameter is required."
    • addedInput schema / properties / doctype / examples
      Added value: +[
      +  "Sales Invoice",
      +  "Customer",
      +  "Item"
      +]
    • changedInput schema / properties / fields / description
      Previous value: -"Optional list of field names to return (e.g. ['name', 'status', 'grand_total'])."New value: +"Optional list of field names to return. Limits the response to only the specified fields for efficiency. Example: ['name', 'status', 'grand_total', 'posting_date']. When omitted, all fields are returned."
    • addedInput schema / properties / fields / examples
      Added value: +[
      +  [
      +    "name",
      +    "status",
      +    "grand_total"
      +  ]
      +]
    • changedInput schema / properties / filters / description
      Previous value: -"Optional list of filters, each as [field, operator, value], e.g. [['status','=','Open']]."New value: +"Optional list of filter conditions. Each filter is a triple [field, operator, value]. Supported operators: =, !=, >, <, >=, <=, like, not like, in, not in, between. Example: [['status','=','Open'], ['grand_total','>','1000']]."
    • addedInput schema / properties / filters / examples
      Added value: +[
      +  [
      +    [
      +      "status",
      +      "=",
      +      "Open"
      +    ]
      +  ],
      +  [
      +    [
      +      "grand_total",
      +      ">",
      +      "1000"
      +    ],
      +    [
      +      "status",
      +      "!=",
      +      "Cancelled"
      +    ]
      +  ]
      +]
    • addedInput schema / properties / filters / items
      Added value: +{
      +  "prefixItems": [
      +    {
      +      "description": "Field name to filter on",
      +      "type": "string"
      +    },
      +    {
      +      "description": "Operator: =, !=, >, <, >=, <=, like, not like, in, not in, between",
      +      "type": "string"
      +    },
      +    {
      +      "description": "Value to compare against",
      +      "type": "string"
      +    }
      +  ],
      +  "type": "array"
      +}
    • addedInput schema / properties / limit / default
      Added value: +20
    • changedInput schema / properties / limit / description
      Previous value: -"Maximum number of results (default 20)."New value: +"Maximum number of results to return (default: 20, maximum: 200). Use for pagination. Frappe caps results at 200 per request."
    • addedInput schema / properties / limit / maximum
      Added value: +200
    • addedInput schema / properties / limit / minimum
      Added value: +1
    • changedInput schema / properties / order_by / description
      Previous value: -"Field to sort by (e.g. 'creation desc')."New value: +"Field to sort by with direction. Format: 'fieldname direction'. Examples: 'creation desc' (newest first), 'modified asc' (oldest updated first), 'name asc' (alphabetical). Default ordering is by creation date descending."
    • addedInput schema / properties / order_by / examples
      Added value: +[
      +  "creation desc",
      +  "modified asc",
      +  "name asc"
      +]
  3. First observedv1.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, yet the description adds material context: role-permission filtering means a short result can signal restricted access rather than no matches, and unknown doctype/fieldnames raise errors instead of being ignored. These are non-obvious failure modes an agent could not infer from structured fields.

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?

Front-loaded purpose sentence followed by clearly labeled Behavior/Parameters/Returns blocks is easy to scan. The explicit Returns line is redundant given a real output schema exists, and the parameter paragraph partially duplicates the schema.

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?

Covers routing, permission semantics, error behavior, filter composition limits, pagination strategy, and result shape — everything needed to call a 5-parameter search tool correctly. Nothing material is left to inference.

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?

With 100% schema coverage the baseline is 3; the description adds a concrete pagination recipe (order on `creation`, filter past the last seen value) that the schema's limit text does not give. However, much of the filter/limit/fields text restates the schema descriptions nearly verbatim, so the net addition is modest.

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?

States a specific verb (search or list) and resource (documents of one DocType), plus the scope modifiers (filters, field selection, ordering, pagination). It explicitly distinguishes itself from frappe_get_doc (exact name known) and frappe_run_method (aggregates/reports), so an agent can route without opening schemas.

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?

Gives both when-to-use (find by field value, browse a DocType) and when-not-to-use with named alternatives for two distinct cases. The exclusions are concrete conditions, not vague hints.

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