Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryYes
messageYes

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

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