在小程序 App 上下文执行表达式
wdt_evaluateExecutes JavaScript expressions or function bodies in the WeChat Mini Program context and returns serializable results for local debugging.
Instructions
在 miniProgram.evaluate 中执行表达式或函数体,返回可序列化结果。默认把输入当表达式自动包成函数;mode=function 时原样传入函数声明。可通过 $args 访问 args 参数。仅用于本地调试,注意副作用。
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": {
"expression": "<expression>"
},
"name": "wdt_evaluate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | 传给函数的参数,可在表达式里用 $args 访问 | |
| mode | No | auto 默认;expression 强制按表达式;statements 按语句块;function 原样传入 | |
| expression | Yes | 表达式(如 getCurrentPages().length)或函数源码 |