arthas_watch
Monitor method execution in a Java process by defining class and method patterns. Returns results inline or provides a job ID for async retrieval.
Instructions
Watch method execution. Runs in background; waits up to awaitMs for completion and returns results inline if done, otherwise returns a job ID. Use arthas_read_log to check output later, arthas_stop_job to stop.
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": {
"classPattern": "<classPattern>",
"methodPattern": "<methodPattern>"
},
"name": "arthas_watch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of times to watch (default: 5) | |
| depth | No | Object traversal depth | |
| before | No | Watch before method execution | |
| awaitMs | No | Wait up to this many ms for inline completion before returning a job ID (default: 5000; pass 0 for pure async) | |
| express | No | OGNL expression (default: {params,returnObj,throwExp}) | |
| timeout | No | Timeout in ms | |
| condition | No | Conditional expression | |
| exception | No | Watch only on exception | |
| classPattern | Yes | Class name pattern | |
| methodPattern | Yes | Method name pattern |