Call a whitelisted server method
frappe_run_methodExecute a whitelisted server-side Python method on a Frappe site for tasks beyond CRUD, such as submitting documents, running reports, or calling custom app APIs.
Instructions
Call a whitelisted server-side Python method on the Frappe site.
Use as the escape hatch for anything the CRUD tools cannot express — submitting or cancelling documents, running reports, computing stock balances, or invoking a custom app's API. Use frappe_get_doc, frappe_search_docs, frappe_create_doc or frappe_update_doc for ordinary record work: they validate their arguments and describe their effects, whereas this tool cannot.
Behavior: the effect is determined entirely by the method named and may read, write, delete or enqueue background jobs, so treat every call as potentially destructive and non-idempotent unless the method is known to be safe. The target must be decorated with @frappe.whitelist(); anything else raises a permission error, as does a method whose own permission checks reject the API user. Calls run synchronously and are subject to the server's request timeout (FRAPPE_TIMEOUT, 30s by default).
Parameters: method is the full dotted import path — module path plus function name — not a DocType method name or a REST path. kwargs maps onto that method's named arguments exactly; names come from its signature, and an unexpected or missing key raises a Frappe error rather than being ignored. Values must be JSON-serialisable, with dates passed as 'YYYY-MM-DD' strings. Omitting kwargs calls the method with no arguments.
Returns: {"message": ...} — the method's return value, whose type depends entirely on the method called.
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": {
"method": "<method>"
},
"name": "frappe_run_method"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kwargs | No | Optional keyword arguments passed to the remote method. Keys must match that method's parameter names exactly — they depend entirely on the method being called, and an unknown key raises an error rather than being ignored. Values must be JSON-serialisable; pass dates as 'YYYY-MM-DD' strings. Example for stock balance: {'item_code': 'ITEM-001', 'warehouse': 'Stores - W'}. Defaults to no arguments when omitted. | |
| method | Yes | Full dotted Python path to the whitelisted method — module path plus function name. Examples: 'frappe.auth.get_logged_user', 'frappe.client.submit', 'erpnext.stock.utils.get_stock_balance', or any custom whitelisted method from an installed Frappe app. Not a REST path and not a DocType method name. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | No | The value returned by the whitelisted method. The type is whatever that method returns — object, array, string, number, boolean or null. Absent when the method returns nothing. |