Tool Reference
Frappe Assistant Core ships 59 built-in tools across 5 plugins. 41 of them are offered to any MCP client at /api/method/frappe_assistant_core.api.fac_endpoint.handle_mcp when every optional plugin is on. The other 18 belong to the faco plugin and work only inside FAC Chat.
| Plugin | Tools | Description |
|---|---|---|
core | 19 | Always enabled. Document CRUD, search, metadata, reports, workflow, email, builder checks. |
data_science | 3 | Optional. Python execution, SQL queries, file content extraction. |
faco | 18 | Optional, FAC Cloud only. Document generation, browser automation, and tools for Frappe CRM, Helpdesk and Insights. These act inside FAC Chat, so they are not offered to other MCP clients. |
migration | 16 | Optional. Bringing a client's data in from their old system: file imports, opening stock, invoices and balances, a chart of accounts, and whole migration plans. |
visualization | 3 | Optional. Dashboards and charts. |
custom_tools | — | Mechanism for external Frappe apps to register their own tools via the assistant_tools hook. No shipped tools. |
To toggle plugins, see Plugin Management. To control which tools each role can call, see Tool Management.
Core plugin (19 tools)
Always enabled. Provides essential Frappe operations.
Document operations (6)
| Tool | Purpose |
|---|---|
create_document | Create a new Frappe document, or several with records (see Many records in one call) |
get_document | Fetch a single document by name, with only its filled-in fields; fields narrows it further |
update_document | Update document fields (supports patch and replace modes for child tables), or several documents with names or records |
document_action | Submit, cancel or amend a submittable document (action: submit, cancel, amend). submit_document is still accepted as a hidden alias |
delete_document | Delete a document (force=true to ignore links), or several with names |
list_documents | Paginated list with filters, fields, and ordering. Pass offset to skip rows; when has_more is true the response carries next_offset for the next page. group_by with aggregate returns database-computed totals per group instead (see Answering business questions) |
Many records in one call
create_document, update_document and delete_document each take a list, so bulk work is one call instead of one per record:
| Tool | One record | Many records |
|---|---|---|
create_document | data | records: a list of field dicts |
update_document | name + data | names + data (the same change to each), or records: [{"name": ..., "data": {...}}] |
delete_document | name | names |
- Each record goes through the tool's single-record path, so it gets the same permission, restricted-field, child-table and server-script checks as a call for that record alone (
run_batch). mode: "all_or_nothing"(the default) saves nothing if any record fails;failed_recordnames the record and its error.mode: "continue"saves the records that pass and returns each record's outcome inresults, withsucceededandfailedcounts.- A record that commits partway, which ends the batch's savepoint, cannot be undone with the rest. The result then has
all_undone: falseand lists the records saved before it. create_documentwithrecords, orupdate_documentwithnamesorrecords, andvalidate_only: truechecks every record, saves nothing, and reports every failing record, not only the first.- A call holds at most 100 records (
MAX_BATCH_SIZE). Customisation DocTypes are refused in a batch, so each customisation is still previewed and approved on its own. - In FAC Chat, the approval card states how many records the call creates, changes or deletes.
Permissions and error messages
create_document, update_document and document_action run as the calling user. Frappe checks the user's permission on the DocType and then on the document itself, and a DocType can add document-level rules of its own. When the DocType-level check fails, the tool returns {"success": false, "error": "Insufficient create permissions for <DocType>", "error_type": "permission_error"}. When the document-level check refuses a create (for example, a ToDo allocated to someone else, when the caller holds no role that grants ToDo access beyond the automatic roles, on Frappe before v16.32.0 / v15.119.0), the tool's result has success: false, the reason in error, and error_type: "permission_error":
{
"success": false,
"error": "You need the 'create' permission on ToDo to perform this action.",
"error_type": "permission_error",
"doctype": "ToDo",
"guidance": "Insufficient permissions for this operation.",
"suggestion": "Contact your system administrator to grant necessary permissions for this DocType"
}Over MCP, this tool result is nested under the result key in the response, and the top-level error_type is ToolReportedError.
- Dry runs.
create_documentwithvalidate_only: trueruns the same create-permission check as a real create, so a dry run does not report success for a document the real create would refuse. A dry run does the preparation Frappe does at insert time before validation: defaults, naming,before_insert, link validation andbefore_validate. It then runs the document's own validation. Everything is rolled back, whatever the outcome. Naming-series counters are restored, but an autoincrement id is not reclaimed, so a dry run on an autoincrement DocType uses up one id, as a failed real insert does (_prepare_for_insert). It does not check mandatory fields, so a real create can still fail on a missing value. A dry run refused by validation or permissions is the answer the caller asked for, so it writes no Error Log row. - Update dry runs.
update_documentwithvalidate_only: true(FAC 3.3) checks a change to an existing record without saving it, for example to test a Before Save rule that compares old and new values. The change goes through the same pre-checks and field setting as a real update. Then the steps Frappe's save runs before it writes: the write-permission and permlevel checks, the submitted-record rules (only allow-on-submit fields may change), link validation,before_validateandvalidate(before_update_after_submiton a submitted record), and the set-only-once check (_check_update). Everything is rolled back, whatever the outcome, including what those rules wrote. Like the create dry run, it does not runbefore_saveand does not check mandatory fields or Select values. A pass returnsvalidation_passed: true, and a refusal returns the rule's own message. - Plain-language refusals. A refused write to a protected customisation DocType returns
error_type: "permission_error"with a message that says what is missing. Changing a Server Script needs a System Manager who also holds the Script Manager role. A Query or Script Report needs the Script Manager role too.
Customisation results
Customisation records change how a site behaves: Server Script, Client Script, Custom Field, Property Setter, Workflow (and its State and Action Master), Custom DocPerm, DocType, Role, Report, Print Format, Notification and FAC Page. A successful create_document or update_document on any record adds url, a link to the saved record in Desk. For these DocTypes it also adds:
| Key | When | Meaning |
|---|---|---|
applies_to | Custom Field, Property Setter, Client Script, Server Script, Print Format, Notification | {doctype, url}: the form the customisation changes, and a link to a new document of that type, where the change shows |
location | Custom Field | {tab, section, collapsed, first_tab}: where the field shows on its form, read after the save. collapsed is true when its section starts folded, and first_tab is false when it sits on a later tab |
placement_warning | Custom Field | A plain sentence, present only when the field lands in a collapsed section or off the first tab, for example "Will appear on the Details tab, in the Extra section (collapsed, hidden until someone opens it). People may not notice it: the section is collapsed." |
page_url | FAC Page | The /app/fac-pages/<name> link where the page opens (a personal page's name is its slug plus an owner tag). url stays the link to its form |
warning | Report | Present when a non-standard Script Report is saved while server scripts are switched off: the report is saved, but it shows an error when someone runs it |
Server scripts switched off
Frappe runs Server Scripts only when the site's server-scripts setting is on, and switching it on needs access to the server (on Frappe Cloud, a private bench). While it is off:
get_doctype_infoforServer ScriptorReportreturnsserver_scripts_enabled(trueorfalse) so the assistant can check before it plans (get_doctype_info).create_documentorupdate_documentrefuses an active Server Script witherror_type: "server_scripts_disabled", because a DocType Event script would stop its document type from saving. Saving the script withdisabledset to 1 is allowed, and it does nothing until scripts are switched on (server_script_guard).- Whether or not scripts are on,
create_documentorupdate_documentrefuses a Server Script whose code would fail in Frappe's sandbox, witherror_type: "server_script_sandbox", and saves nothing. Frappe's own save only warns when code does not compile, and the other failures show only when the script runs. The check compiles the code with Frappe's sandbox policy, then flags a blocked attribute such as.format()and afrappe.*name the sandbox does not have, such asfrappe.get_roles.errornames each line and what to use instead. It runs when the code changes or the script ends up switched on, so a broken script can still be switched off (server_script_code_guard,sandbox_problems). update_documentnever renames a record. A rename sent asnew_name,rename, or adata.namethat differs from the record is skipped, the other changes are saved, and the result carries awarningpointing to Rename in Desk. An update that holds only a rename returnserror_type: "rename_not_supported". The skills therefore name records by what they do ("Discount limit on Sales Invoice submit"), never by a value that may change, so changing a value needs no rename.- ToDo. Frappe decides who may create a ToDo. Before v16.32.0 / v15.119.0, a user without a role that grants ToDo access beyond the automatic roles (on a stock site, System Manager) could create only a ToDo that names them, as
allocated_toorassigned_by. From those releases the ToDo's owner is also accepted, and the creator owns it, so a user may create any ToDo. On the older releases,create_documentallocates a ToDo that names nobody to the calling user instead of failing; on the newer ones it changes nothing. Administrator and System Managers are unaffected: their ToDo stays unallocated. On the older releases a ToDo allocated to someone else is still refused, anderrorsays why. If the ToDo also names areference_typeandreference_name, allocating it to you also assigns that document to you, exactly as Assign to me does in the Desk: you are added to the document's assignments and an Assigned comment is posted on its timeline.
Confirmation before destructive calls
delete_document, document_action with cancel (except on a DocType with an active Workflow, where document_action refuses the cancel and run_workflow asks instead), a run_workflow action that moves the document to a cancelled state, and send_email ask the user before they run, when the client calling them supports it. That takes a client on the 2026-07-28 protocol that declares form elicitation in its capabilities. The first tools/call then changes nothing and returns resultType: "input_required" with one form, keyed confirm, that asks the question (for example "Delete ToDo abc123? This can't be undone.") and a signed requestState. The client shows the form and sends the same call again with inputResponses.confirm and the requestState:
- Accepted (
action: "accept"withconfirm: true): the call runs once. - Declined, cancelled, or
confirm: false: nothing runs, and the result hasisError: truewith the text "The user did not confirm, so nothing was changed." - No answer with a valid
requestState: the form is sent again with a newrequestState. - A
requestStatethat is forged, older than 10 minutes, already used, or issued for another user, tool or set of arguments gets JSON-RPC error-32602and nothing runs. EachrequestStateis good for one answer.
Clients on the older protocol versions, and clients that do not declare form elicitation, run these calls at once, as before. FAC Chat is never asked, whatever it declares: it shows its own approval card, so the user is asked once (gate).
Search (3)
FAC 3.0 collapsed the four search tools that older versions shipped (search, search_doctype, search_link, a bare fetch) into a single search_documents tool, plus the two OpenAI-compatible adapters below that wrap it.
| Tool | Purpose |
|---|---|
search_documents | Text search across DocTypes |
chatgpt_search | OpenAI MCP-compatible search adapter — wraps search_documents and returns {id, title, url} items |
chatgpt_fetch | OpenAI MCP-compatible fetch adapter — returns full document content as {id, title, text, url, metadata} |
Metadata (1)
| Tool | Purpose |
|---|---|
get_doctype_info | Field definitions, link fields, permissions, and naming info for a DocType. Pass topic instead of doctype to find where a subject's data lives |
Reports (3)
| Tool | Purpose |
|---|---|
report_list | Find reports the user can run. query searches by what the user asked (limit default 10, max 25); module and report_type (Script Report, Query Report, Report Builder) filter. With no arguments it returns a per-module report count, not every report |
report_requirements | Describe a report's required filters, columns, and metadata before running it |
generate_report | Execute a Script or Query Report. Report Builder reports are not supported. Returns at most max_rows rows (default 500, up to 5000) with row_count and truncated; a totals row is kept. summary_only returns the count and columns without rows. A prepared report is awaited for at most 15 seconds, then the call returns status: "timeout" (still being prepared); calling again with the same filters picks up the same report. Every successful result has defaulted_filters, the filters FAC filled in |
Answering business questions
When a user asks a business question ("what are our overdue receivables?", "sales by territory this quarter"), the assistant is instructed (in the tool descriptions; the code does not enforce the order) to try sources in this order and stop at the first that fits:
- A matching custom report on the site. A report someone built in the UI is the site's own definition of the number, so on an equal match a report built on this site ranks above a standard one.
- A standard ERPNext report.
- A grouped query on the right DocType, using
list_documentswithgroup_byandaggregate.get_doctype_infowithtopicfinds the DocType first when the subject is not obvious.
The answer names the report and the filters it ran with, or the records and DocType it used. When FAC filled in a filter the user did not give (period, company), the answer states the value used; the defaulted_filters field of generate_report lists them.
Finding a report: report_list
queryranks the reports the user can run against the question.limitcaps the list (default 10, maximum 25).report_typeis ignored whenqueryis given.- Each
queryresult carriesorigin(customorstandard),ref_doctype(the source DocType),mandatory_filters,prepared(the report runs in the background) andpurpose(a short description for standard reports, otherwise null). Results frommoduleorreport_typewithoutquerycarryname,report_name,report_type,module,is_standardanddisabledinstead. - With no arguments the tool returns a count of reports per module rather than every report.
- Only reports the user may run are listed: enabled, permitted by the report's roles, and with
reportpermission on its reference DocType. This is Frappe's own rule.
Running a report: generate_report
- A prepared report is awaited for at most 15 seconds. If it is not ready, the result is
status: "timeout"with the report'sprepared_report_name: the report is still being prepared, not empty. Call again with the same filters and the retry picks up that report. - A client on the 2026-07-28 protocol that declares the tasks extension (
io.modelcontextprotocol/tasks) is not made to wait. When the report has to be queued, or is already running for the same filters,tools/callreturnsresultType: "task"straight away, with astatusMessagesuch as "Preparing General Ledger", and the client pollstasks/get. While the Prepared Report is queued or running the task isworking. Once it completes, the task iscompletedwith the same result the call would have returned for that report; if the report fails, the task isfailedwith the report's error message. Each poll runs as the user who started the task: if they may no longer run the report, the task isfailedand no rows are returned (prepared_report_task_progress). A report already prepared for the same filters, or one that runs inline, is returned at once, not as a task. Without the tasks extension the call waits as described above. - A prepared report that fails returns
success: falseandstatus: "error"with the error text. - For totals, the assistant uses
summary_only, which returns the columns,row_countandreport_summarywithout rows.
Locating data: get_doctype_info with topic
Passing topic (for example "bookings") instead of doctype returns up to eight DocTypes whose name or module matches, singular or plural, custom DocTypes first on a tie. Each entry has has_data (yes or no, never a count), date_fields, amount_fields, party_fields and custom_fields. Only DocTypes the user may read are listed, and fields above the user's permission level or marked sensitive are left out. Child tables and Single DocTypes are not listed. For users with the Assistant User role, the settings DocTypes FAC hides from that role are also left out.
Grouped totals: list_documents with group_by and aggregate
{
"doctype": "Sales Invoice",
"filters": {"posting_date": [">=", "2026-01-01"]},
"group_by": "territory",
"aggregate": [{"function": "sum", "field": "base_grand_total"}]
}functionissum,count,avg,minormax, with at most 5 aggregates.sumandavgneed a numeric field (Currency, Float, Int or Percent).- The database computes each figure over only the records the user may read, under both role permissions and User Permissions. The numbers are not summed from a truncated listing.
- Submittable DocTypes default to submitted documents unless you pass
docstatus; the response says so withdocstatus_defaulted. - Restricted, higher-permlevel and non-numeric (for
sumandavg) fields are refused with an explanation. For users with the Assistant User role, the settings DocTypes FAC hides from that role (System Settings, Print Settings, Email Domain, Social Login Key and similar) are refused; virtual DocTypes are refused for everyone. limitcaps the number of groups (default 100);has_moreis true when groups were cut off.
Workflow (2)
| Tool | Purpose |
|---|---|
run_workflow | Trigger a workflow action (Approve, Reject, etc.) on a document |
get_pending_approvals | List documents awaiting the current user's workflow action — this queries Frappe's own Workflow Actions, not an AI approval gate (see FAC Chat for that). Only documents the user can open are listed: User Permissions on the referenced document apply |
Email (1)
| Tool | Purpose |
|---|---|
send_email | Queue an email via the site's Email Account |
Builder checks (3)
Read-only tools the assistant uses while it builds a customisation, so it does not learn the Server Script sandbox by trial and error. They save nothing, run no code and never switch user. Only System Managers can call them, and they are classified read-only, so FAC Chat shows no approval card for them.
| Tool | Purpose |
|---|---|
test_as_user | Check what another user is allowed to do: up to 20 checks of a permission type (read, write, create, delete, submit, cancel and so on) on a DocType or one record. Frappe's own rules decide, for that user: role permissions, User Permissions, ownership, shares and has_permission hooks. Each check returns allowed, refused or error with a fixed reason, plus roles_that_allow, the roles that grant it. The result never carries the record's content (TestAsUser) |
sandbox_reference | List the names a Server Script can use on this site, built from Frappe's own sandbox, optionally filtered by a prefix such as frappe.db. Names unavailable in DocType Event scripts (commit, rollback, add_index) are listed under not_in_doctype_event, and rules lists the limits that are not names, such as SELECT-only frappe.db.sql (SandboxReference) |
recent_errors | Read recent Error Log entries and failed scheduled jobs, newest first, optionally filtered by text such as a script name. Error text can include request data, so treat it as private (RecentErrors) |
A permission hook that reads frappe.session.user instead of its user argument answers test_as_user for the caller, not the user being checked. Administrator is always allowed.
Data Science plugin (3 tools)
Optional. Requires pandas and numpy.
| Tool | Permissions | Purpose |
|---|---|---|
run_python_code | System Manager | Execute Python in an isolated subprocess sandbox. Pre-loaded: pd, np, frappe, math, datetime, json, re, random. Plotting libraries are not available. |
run_database_query | System Manager | Execute read-only SELECT queries. INSERT/UPDATE/DELETE/DDL and multi-statement queries are rejected. Never returns more than 1000 rows (a larger LIMIT is clamped) and reports truncated when rows were cut. |
extract_file_content | File read | OCR and text extraction from File DocType attachments. Supports PDF, images, DOCX, XLSX, TXT. Backend is PaddleOCR (default) or Ollama vision (configurable). |
See Python Code Orchestration and Code Execution Security for the sandbox details.
FACO plugin (18 tools)
Optional, and reachable only from FAC Cloud. Every tool here needs something no other MCP client can provide: the browser tools run inside the FAC Chat page and talk to it over Socket.IO, generate_document renders through FAC Chat's rich-block renderer, and attach_chat_file acts on files uploaded in FAC Chat.
So these tools are hidden from any other client. They do not appear in tools/list, and tools/call refuses them, for Claude Desktop, ChatGPT, Cursor or anything you connect yourself. FAC recognises FAC Cloud by the OAuth client its token belongs to, not by anything the client claims about itself.
Before this, they were offered to every client and could not work: calling browser_take_screenshot from Claude Desktop published a request to a page that was not there and failed only after a 30 second timeout.
send_email has no such dependency, so it lives in the core plugin and stays available to every MCP client.
| Tool | Purpose |
|---|---|
generate_document | Render rich-block content to an HTML/PDF document |
attach_chat_file | Attach a file the user uploaded in chat to a document, as a copy |
browser_get_form_data | Read form field values from the user's current page |
browser_get_page_context | Get structured info about the user's current page |
browser_capture_diagnostics | Collect console errors, network errors, and a screenshot from the user's browser |
browser_navigate_to | Navigate the user's browser to a Frappe route |
browser_take_screenshot | Capture a screenshot of the user's current page |
browser_wait_for_page | Wait for the user's page to finish loading |
The browser tools act on the user's own browser, not on the server, and need the FAC Chat page open to reach it.
Which chat runs which browser tool. All of them run in the Desk widget. The full chat app (/copilot) runs only browser_take_screenshot, which captures the page open beside the chat and returns its page_errors and page_text. A call belongs to the client whose turn asked for it, or to the chat app once it has taken a widget's turn over with Open Full Assistant (resolve_call_client). When the chat app holds the turn, any other browser tool is answered at once with an error that tells FACO to use browser_take_screenshot instead (chat app, browser_navigate_to, which never waits for the browser). The chat app never leaves for Desk to run one. Before this, it left such a call unanswered, and FACO waited until the call timed out.
A call in flight when the user opens the full assistant. Open Full Assistant moves the Desk tab to the chat app, so the widget, and any approval card it was showing, is gone. When the chat app takes the turn over, the server goes through every widget call it is still waiting on (_hand_over_widget_calls):
| The call when the user opens the full assistant | What happens |
|---|---|
| Not yet taken by the widget | Queued again for the chat app, which answers it as its own |
| Taken by the widget (card open, running, or picked up while the page loaded) | Answered at once with an error that says the user moved to the full chat app. For a screenshot it tells FACO to ask again, and the chat app then asks the user; any other tool gets the Desk-only error above |
| Already answered | Left alone, and never asked about again in the chat app |
So FACO is never left waiting on a widget that has gone. Before this, a call the widget had already taken waited up to two minutes and ended with "The user did not respond to the approval prompt in time".
Frappe CRM, Helpdesk and Insights (8)
These work on sites with the app installed, and always as the user asking, with that user's own permissions in the app.
| Tool | Purpose |
|---|---|
get_crm_activity | Read a CRM lead's or deal's whole history (emails, notes, calls, tasks, comments and field changes, newest first) through CRM's own timeline |
send_crm_email | Email a CRM lead or deal from the record, as CRM's email composer does: it lands on the record's Emails tab and goes out from the user's email account. The user sees the full email in an approval card first |
add_crm_activity | Add a note, a follow-up task or a call log to a lead or deal, linked so it shows on the record's Notes, Tasks or Calls tab. A task is assigned to the user unless someone else is named |
convert_crm_lead | Convert a lead into a deal through CRM's own conversion, as the Convert to Deal button does: a contact and organization are created or reused and the deal carries the lead's history. Converting the same lead again returns its deal |
reply_to_helpdesk_ticket | Reply to the customer on a Helpdesk ticket, as an agent would: the reply is added to the ticket thread and emailed to the person who raised it. The user approves the reply in a card first. Only Helpdesk agents can reply |
list_insights_dashboards | List the Insights dashboards the user can open, optionally searching titles |
get_insights_dashboard | Read an Insights dashboard as the user sees it: its filters and each chart's numbers, with the dashboard's default filters or the overrides given |
get_insights_chart | Read one Insights chart in depth, applying its dashboard's filters |
Writes such as these pause for approval in FAC Chat, so nothing is sent or changed until the user approves it. See Use the widget in other Frappe apps.
Internal checks (2)
FAC Cloud calls these two itself. They never write, and the assistant does not use them to answer users.
| Tool | Purpose |
|---|---|
customisation_impact | Reports whether a customisation write would change anything beyond what its builder can see yet, so FAC Cloud knows whether to ask for approval |
check_build_plan | Reports, for each change in a build plan, why it cannot be written as listed and whether it goes live. System Manager only |
Migration plugin (16 tools)
Optional. Brings a client's data into ERPNext from Excel, CSV, Google Sheets or Tally exports. See Bringing Your Data In for how the tools are used together.
| Tool | Purpose |
|---|---|
start_import_session | Open an import for one file: a spreadsheet, a Tally XML export or a Google Sheets link |
get_import_schema | List the fields an import can fill on a DocType, with its child tables |
set_column_mapping | Save which column of the file goes to which ERPNext field |
dry_run_import | Check every row the way the real import would, writing nothing |
start_import | Import a checked file through Frappe's Data Import, once the user approves |
set_opening_stock | Treat the file as opening stock, to be brought in as a Stock Reconciliation |
import_opening_stock | Bring checked opening stock in as a submitted Stock Reconciliation |
set_opening_invoices | Treat the file as opening receivables or payables |
import_opening_invoices | Bring checked receivables or payables in as opening Sales or Purchase Invoices |
set_opening_balances | Treat the file as the old system's closing trial balance |
import_opening_balances | Bring the checked trial balance in as one opening Journal Entry |
plan_migration | Group several imports into one plan, ordered so each file follows the files it links to |
run_migration_plan | Run a ready plan in the background, once the user approves |
stop_migration_plan | Stop a plan when the user asks; what is already imported stays |
import_chart_of_accounts | Put the client's own chart of accounts on a company |
replace_chart_of_accounts | Replace a company's chart of accounts, only while nothing has been posted to it |
Visualization plugin (3 tools)
Optional. Requires pandas, numpy, and a charting backend.
| Tool | Purpose |
|---|---|
create_dashboard | Create a Frappe Dashboard with optional chart membership, filters, sharing, and refresh interval |
create_dashboard_chart | Create a Dashboard Chart and optionally attach it to an existing dashboard via dashboard_name |
list_user_dashboards | List dashboards visible to the current user (dashboard_type: all, frappe, insights) |
Custom Tools plugin
The custom_tools plugin discovers tools registered by other installed Frappe apps via the assistant_tools hook. It ships with no tools of its own — see your installed apps' documentation for what they expose.
Output shapes
Seven read tools declare what a successful call returns: list_documents, get_document, search_documents, get_doctype_info, report_list, report_requirements and generate_report.
For a client on the 2026-07-28 protocol:
tools/listgives each of these tools anoutputSchema.- A successful
tools/callreturns the result twice: as JSON text incontent, as before, and asstructuredContent. The two are the same data. Anything FAC marks as the content of a user's file is fenced in both. - A failed call sets
isErrorand has nostructuredContent. - A number JSON cannot hold (NaN or an infinity, which a report can compute) is
nullinstructuredContent. The text is unchanged.
A client on an earlier protocol version is sent neither field, so what it receives is unchanged.
Because a result now arrives as text and as data, a client that keeps tool results in its conversation history should keep one of the two.
The schemas are deliberately loose. Each names the fields a caller relies on, such as data, rows, total_count and has_more for list_documents, and allows any others. No field is marked required. This lets FAC add a field without a client refusing the result.
What this is for: a client that lets its model write a short program over tool calls needs to tell the model what each call returns. With a declared shape it can, for any server, without knowing FAC.
Permission denials
Frappe signals a document-level permission denial by raising a bare frappe.PermissionError and keeping the readable reason in frappe.flags.error_message, so str(exception) is an empty string. A tool that reported that exception directly returned an empty error, and the model treated the denial as a field problem and retried.
Every write tool now reports a denial in one shape (permission_error_result):
{
"success": false,
"error": "You need the 'create' permission on ToDo to perform this action.",
"error_type": "permission_error",
"doctype": "ToDo",
"guidance": "Insufficient permissions for this operation.",
"suggestion": "Contact your system administrator to grant necessary permissions for this DocType"
}error carries Frappe's own reason as plain text, recovered by exception_message, which falls back to the exception's text, then Frappe's reason, then a per-tool default, then the exception class name — so it is never empty. Markup is stripped from both sources, because Frappe and ERPNext messages embed <strong> and <a href>. The tools that return this shape:
| Tool | Denial handler |
|---|---|
create_document | create_document.py:492 |
update_document | update_document.py:687 |
document_action (submit) | document_action.py:241 |
document_action (cancel) | document_action.py:352 |
document_action (amend) | document_action.py:524 |
create_dashboard | create_dashboard.py:134 |
create_dashboard_chart | create_dashboard_chart.py:206 |
delete_document keeps its own result shape (permission_error: true) but reports the same recovered reason (delete_document.py:170). Any tool that does not catch the exception itself falls through to BaseTool._safe_execute (base_tool.py:288), which applies the same recovery.
error_type: "permission_error" means the request was refused, not malformed: retrying with different field values cannot succeed.
ToDo creation
Frappe decides who may create a ToDo. Before Frappe v16.32.0 / v15.119.0, a user without a role granting ToDo create (such as System Manager) may create only a ToDo naming them (allocated_to or assigned_by), so create_document allocates a ToDo that names nobody to the calling user, and one naming someone else is still refused. From those releases (frappe/frappe#41869) ownership alone carries the create, and the ToDo is left exactly as written.
Per-tool documentation
Per-tool inputSchema, return shape, and behaviour notes live in the source repo alongside each tool implementation:
The authoritative inputSchema for any tool is in its Python file's __init__.