Skip to main content
Glama

agent_state_load_state

Load saved agent state from a file to resume work after interruption, using a directory path to locate the state file.

Instructions

Load the current agent state from the state file.

Args: directory: Absolute path to the GitHub worktree or repository directory where the state file is located

Returns: The current state string, or empty string if the file doesn't exist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:94-109 (handler)
    The handler function `agent_state_load_state` registers the MCP tool and reads the agent state from the `.agent-state.txt` file in the specified directory.
    @mcp.tool()
    def agent_state_load_state(directory: str) -> str:
        """Load the current agent state from the state file.
    
        Args:
            directory: Absolute path to the GitHub worktree or repository directory
                       where the state file is located
    
        Returns:
            The current state string, or empty string if the file doesn't exist
    
        """
        state_file = get_state_file(directory)
        if not state_file.exists():
            return ""
        return state_file.read_text(encoding="utf-8")
Behavior3/5

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

With no annotations, description carries full burden. Discloses critical 'empty string if file doesn't exist' behavior, but fails to explicitly state read-only nature, thread-safety, or state file format expectations.

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?

Uses structured Args/Returns format that is concise and front-loaded with purpose. Information density is high with no redundant sentences, though pseudo-code style is slightly less natural than prose.

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?

Appropriately complete for a single-parameter read operation. Leverages existence of output schema to avoid over-explaining return values while still disclosing the empty-string edge case.

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?

Excellent compensation for 0% schema coverage. Describes 'directory' as 'Absolute path to the GitHub worktree or repository directory where the state file is located', providing domain context (GitHub) and file location semantics beyond raw schema.

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?

States specific verb (Load) + resource (agent state) + source (state file). Distinguishes from siblings implicitly via 'load' vs 'update' (update_state) and 'state' vs 'log' (load_log), though explicit differentiation is absent.

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?

Provides no guidance on when to use this versus agent_state_update_state (read vs write) or agent_state_load_log (state vs log history). No prerequisites or conditions specified.

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