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()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure but fails to address critical traits: it does not specify the log file naming convention, concurrency behavior, encoding, maximum size limits, or whether the operation is atomic. It only confirms the append operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with a clear first sentence stating the action. The Args structure efficiently documents parameters without redundancy, though the mixture of narrative and docstring-style formatting is slightly inconsistent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description adequately covers the two input parameters but leaves gaps regarding return values (no output schema exists), error conditions, and the specific log file path/name generation. For a simple logging utility, this is minimally viable but incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Given 0% schema description coverage, the Args section effectively compensates by providing clear semantics for both parameters. It specifies that 'directory' requires an absolute path to a GitHub worktree/repository and that 'message' is the content to append, though it omits format constraints or validation rules.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the core action ('Append a message to the log file') with a specific verb and resource. However, it does not explicitly differentiate from the sibling tool 'agent_state_load_log' or clarify when logging is preferred over state updates.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus the sibling state management tools (load_log, load_state, update_state). There is no mention of prerequisites, such as whether the directory must exist or if the log file is created automatically.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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