Skip to main content
Glama
memstate-ai

Memstate AI - Agent Memory System

Official

memstate_set

Store simple configuration values, status flags, or version numbers at specific hierarchical keypaths for AI agent memory management.

Instructions

Set one keypath to a short value. Only for simple key=value facts like config, status, or version numbers.

USE THIS WHEN: You need to store ONE specific value at a known keypath (e.g. a port number, a status flag, a version string). NOT FOR: Task summaries, markdown, or text with multiple facts — use memstate_remember instead.

memstate_set(project_id="myapp", keypath="config.database.port", value="5432") memstate_set(project_id="myapp", keypath="status.deployment", value="production") memstate_set(project_id="myapp", keypath="version.current", value="2.1.0")

Value limit: 2,000 chars. If longer, use memstate_remember instead. Keypath is auto-prefixed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesRequired. Project to store in (e.g. 'myapp'). Auto-creates if new.
keypathYesRequired. Hierarchical path like 'config.port' or 'status'. Auto-prefixed with 'project.{project_id}.'
valueYesThe value to store (max 2,000 chars). Short, simple values only — not markdown.
categoryNoCategory: decision, preference, fact, task, context, requirement, note, code, learning
topicsNoOptional additional topics/tags

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual handler logic for `memstate_set`, which sends a POST request to the Memstate API's /memories/remember endpoint.
    def set_memory(project_id, keypath, value, category=None, topics=None):
        url = f"{BASE_URL}/memories/remember"
        headers = {
            "X-API-Key": API_KEY,
            "Content-Type": "application/json",
            "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
        }
        
        data = {
            "project_id": project_id,
            "keypath": keypath,
            "content": value
        }
        
        if category:
            data["category"] = category
        if topics:
            data["topics"] = topics.split(",")
    
        req = urllib.request.Request(url, data=json.dumps(data).encode("utf-8"), headers=headers, method="POST")
        
        try:
            with urllib.request.urlopen(req) as response:
                result = json.loads(response.read().decode("utf-8"))
                print(json.dumps(result, indent=2))
                return 0
        except urllib.error.HTTPError as e:
            print(f"Error: {e.code} - {e.read().decode('utf-8')}", file=sys.stderr)
            return 1
        except Exception as e:
            print(f"Error: {e}", file=sys.stderr)
            return 1
    
    if __name__ == "__main__":
        parser = argparse.ArgumentParser(description="Set a single fact at a specific keypath")
        parser.add_argument("--project", required=True, help="Project ID")
        parser.add_argument("--keypath", required=True, help="Hierarchical path (e.g., config.port)")
        parser.add_argument("--value", required=True, help="Value to store")
        parser.add_argument("--category", help="Category (decision, fact, config, etc.)")
        parser.add_argument("--topics", help="Comma-separated list of topics")
        
        args = parser.parse_args()
        sys.exit(set_memory(args.project, args.keypath, args.value, args.category, args.topics))
Behavior4/5

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

With no annotations provided, the description carries full burden and delivers well. It discloses key behavioral traits: value limit (2,000 chars), auto-prefixing of keypath, and that it's for storage/mutation (implied by 'set'). It doesn't mention error conditions, permissions, or rate limits, but provides substantial operational context beyond basic function.

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?

The description is perfectly structured and concise. It opens with the core purpose, provides clear usage guidelines in dedicated sections, includes practical examples, and adds important constraints. Every sentence earns its place with no wasted words, and information is front-loaded appropriately.

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

Completeness5/5

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

Given the tool's moderate complexity (storage operation with 5 parameters), 100% schema coverage, and presence of an output schema, the description is complete. It covers purpose, usage guidelines, constraints, and provides examples. The output schema means return values don't need explanation in the description.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The description adds minimal parameter semantics beyond the schema: it reinforces that value should be 'short, simple values only' and provides concrete examples of keypath usage. However, it doesn't explain the optional 'category' parameter's purpose or provide guidance on when to use topics.

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 clearly states the tool's purpose: 'Set one keypath to a short value' with specific examples of what to store (config, status, version numbers). It explicitly distinguishes from sibling memstate_remember by stating 'Only for simple key=value facts' and 'NOT FOR: Task summaries, markdown, or text with multiple facts.'

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

Usage Guidelines5/5

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

The description provides explicit usage guidance with dedicated sections: 'USE THIS WHEN:' for appropriate scenarios (storing one specific value at known keypath) and 'NOT FOR:' for exclusions (task summaries, markdown, multi-fact text). It names the alternative tool (memstate_remember) and includes a value length threshold (2,000 chars) for when to switch tools.

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/memstate-ai/memstate-mcp'

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