evaluate
Execute custom JavaScript functions inside WeChat mini-program's AppService context and receive their return values, with access to globals like getApp and getCurrentPages.
Instructions
注入函数源码在 AppService 中执行并返回结果(可访问 getApp/getCurrentPages 等全局)
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": {
"code": "<code>"
},
"name": "evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | 执行时传入函数的参数 | |
| code | Yes | 注入 AppService 执行的函数源码字符串,如 function() { return getApp().globalData.userInfo } |