agent_state_log_message
Append messages to a log file for tracking AI agent progress and maintaining event history across sessions, ensuring continuity when agents are interrupted and resumed.
Instructions
Append a message to the log file.
Args: directory: Absolute path to the GitHub worktree or repository directory where the log file should be saved message: The message to append to the log
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": {
"directory": "<directory>",
"message": "<message>"
},
"name": "agent_state_log_message"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| directory | Yes | ||
| message | Yes |
Implementation Reference
- main.py:113-124 (handler)The implementation of the agent_state_log_message tool, which appends a message to the .agent-log.txt file in the specified directory.
def agent_state_log_message(directory: str, message: str) -> None: """Append a message to the log file. Args: directory: Absolute path to the GitHub worktree or repository directory where the log file should be saved message: The message to append to the log """ log_file = get_log_file(directory) with log_file.open("a", encoding="utf-8") as f: f.write(f"{message}\n") - main.py:112-112 (registration)Registration of the agent_state_log_message tool using the @mcp.tool() decorator.
@mcp.tool()