create_server_script
Create a new ERPNext Server Script from script code and type, using smart mode for validation or standard mode for legacy setups. Define events, API methods, and reference DocTypes as needed.
Instructions
Create a new Server Script in ERPNext (unified – use mode = 'standard' | 'smart')
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": {
"script_type": "<script_type>",
"script": "<script>"
},
"name": "create_server_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Creation mode: 'smart' (default) or 'standard' (legacy). Smart mode performs validation. | smart |
| name | No | Script name (optional) | |
| event | No | Event type (for DocType Event scripts) | |
| script | Yes | Script code | |
| disabled | No | Whether script is disabled (1/0, optional, defaults to 0) | |
| script_type | Yes | Script Type (DocType Event, API, etc.) | |
| api_method_name | No | API method name (for API scripts) | |
| reference_doctype | No | Reference DocType (optional) | |
| is_system_generated | No | Is system generated (1/0, optional, defaults to 0) |