Skip to main content
Glama

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
NameRequiredDescriptionDefault
directoryYes
stateYes

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")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tianhuil/agent-state'

If you have feedback or need assistance with the MCP directory API, please join our Discord server