agent_state_update_state
Update the agent's current state description to track progress and maintain continuity across sessions by saving state to a specified directory.
Instructions
Update the agent state file, replacing its contents.
Args: directory: Absolute path to the GitHub worktree or repository directory where the state file should be saved state: The current state description of what the agent is trying to do
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| directory | Yes | ||
| state | Yes |
Implementation Reference
- main.py:80-92 (handler)The `agent_state_update_state` tool is defined here as an MCP tool using `@mcp.tool()`. It takes a `directory` and `state` string, validates the directory using `get_state_file`, and writes the state to `.agent-state.txt`.
@mcp.tool() def agent_state_update_state(directory: str, state: str) -> None: """Update the agent state file, replacing its contents. Args: directory: Absolute path to the GitHub worktree or repository directory where the state file should be saved state: The current state description of what the agent is trying to do """ state_file = get_state_file(directory) state_file.write_text(state, encoding="utf-8")