Skip to main content
Glama

agent_state_load_log

Retrieve recent log entries from agent state files to review progress and maintain continuity when resuming interrupted AI agent sessions.

Instructions

Load the last num_chars characters from the log file.

Args: directory: Absolute path to the GitHub worktree or repository directory where the log file is located num_chars: The number of characters to retrieve from the end of the log

Returns: The last num_chars characters from the log, or the entire log if it's shorter

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryYes
num_charsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:127-146 (handler)
    The agent_state_load_log tool implementation which reads the content of the .agent-log.txt file and returns the last num_chars characters.
    @mcp.tool()
    def agent_state_load_log(directory: str, num_chars: int) -> str:
        """Load the last num_chars characters from the log file.
    
        Args:
            directory: Absolute path to the GitHub worktree or repository directory
                       where the log file is located
            num_chars: The number of characters to retrieve from the end of the log
    
        Returns:
            The last num_chars characters from the log, or the entire log if it's shorter
    
        """
        log_file = get_log_file(directory)
        if not log_file.exists():
            return ""
        content = log_file.read_text(encoding="utf-8")
        if len(content) <= num_chars:
            return content
        return content[-num_chars:]
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses the tail-reading behavior and the edge case (returning entire log if shorter), but omits safety characteristics, error handling (file not found), and side effects.

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

Conciseness5/5

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

Uses a structured docstring format with Args and Returns sections. The opening sentence summarizes the operation, and every subsequent line provides specific parameter or return value details without redundancy.

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

Completeness4/5

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

Given the tool's low complexity (2 primitive parameters) and existence of an output schema, the description is nearly complete. It documents both parameters and return behavior, though it could be improved by mentioning error conditions like missing files.

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

Parameters5/5

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

The schema has 0% description coverage, but the description fully compensates via the Args block. It clarifies that 'directory' expects an absolute path to a GitHub worktree and that 'num_chars' retrieves from the end of the log, adding crucial context absent from the schema.

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

Purpose5/5

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

The description specifies the exact operation (Load), resource (log file), and scope (last num_chars characters). It clearly distinguishes from sibling tools like 'load_state' by explicitly referencing the 'log file' rather than state.

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?

The description provides no guidance on when to use this tool versus siblings (e.g., when to load logs vs. loading state) nor does it mention prerequisites like the log file's existence. Only behavioral edge cases are covered.

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