Create Python tool
create_python_toolCreate a custom Python tool an agent can call: code run in the sandbox, with the internet, the Vault read-only at /data and 30 s a call. _args is the call's arguments as a dict; what the code prints is the tool's result (print JSON for structured results). Its code reads no workspace variable until a person adds one in the tool's editor (Tools, the tool, 'Variables this tool can read'): when it needs a key, name the variable and say so. Prove it with test_python_tool. Re-creating a Python tool with an existing name replaces it, keeping the variables a person added.
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": {
"name": "<name>",
"description": "<description>",
"code": "<code>"
},
"name": "create_python_tool"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The Python source. Reads `_args`, prints its result. | |
| name | Yes | Unique tool name (snake_case, e.g. region_totals) | |
| group | No | Optional group name to file the tool under | |
| read_only | No | false when this GET changes something (e.g. /send?to=…). Omit otherwise. | |
| idempotent | No | false when calling twice does the work twice (books two rooms). Omit otherwise. | |
| open_world | No | Every HTTP tool reaches outside this workspace; omit. | |
| description | Yes | What the tool does — the model reads this to decide when to call it | |
| destructive | No | true when a call deletes, cancels, pays or sends something that cannot be undone. Omit otherwise. | |
| confirm_token | No | Leave out at first: the answer previews what this would do and gives a token. Call again with the same arguments and that token to do it. | |
| input_schema_json | No | JSON Schema object describing the tool's arguments, e.g. '{"type":"object","properties":{"path":{"type":"string"}},"required":["path"]}' |