Skip to main content
Glama

add_episode

Add knowledge episodes to memory for AI learning, enabling the system to detect patterns from user corrections and update configuration files automatically.

Instructions

Add knowledge episode to memory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesEpisode content
nameYesEpisode name
sourceNoSource of episodeuser

Implementation Reference

  • The core handler function that executes the add_episode tool logic: inserts the episode data into the SQLite 'episodes' table and updates the FTS search index.
    async def _add_episode(self, name: str, content: str, source: str = "user") -> Dict[str, Any]:
        """Add episode to memory"""
        try:
            with sqlite3.connect(self.db_path) as conn:
                cursor = conn.execute(
                    "INSERT INTO episodes (name, content, source) VALUES (?, ?, ?)",
                    (name, content, source)
                )
                episode_id = cursor.lastrowid
                
                # Update search index
                conn.execute(
                    "INSERT INTO episodes_search (rowid, name, content, source) VALUES (?, ?, ?, ?)",
                    (episode_id, name, content, source)
                )
                
                conn.commit()
                
                return {
                    "success": True,
                    "id": episode_id,
                    "message": f"Episode '{name}' added successfully"
                }
        except Exception as e:
            return {"success": False, "error": str(e)}
  • JSON schema defining the input parameters for the add_episode tool, including name, content (required), and optional source.
    inputSchema={
        "type": "object",
        "properties": {
            "name": {"type": "string", "description": "Episode name"},
            "content": {"type": "string", "description": "Episode content"},
            "source": {"type": "string", "description": "Source of episode", "default": "user"},
        },
        "required": ["name", "content"],
    },
  • Registration of the add_episode tool in the list_tools() handler, defining name, description, and schema.
    Tool(
        name="add_episode",
        description="Add knowledge episode to memory",
        inputSchema={
            "type": "object",
            "properties": {
                "name": {"type": "string", "description": "Episode name"},
                "content": {"type": "string", "description": "Episode content"},
                "source": {"type": "string", "description": "Source of episode", "default": "user"},
            },
            "required": ["name", "content"],
        },
    ),
  • Dispatch logic in the call_tool() handler that routes 'add_episode' calls to the _add_episode implementation.
    if name == "add_episode":
        result = await self._add_episode(
            arguments["name"],
            arguments["content"],
            arguments.get("source", "user"),
        )
        return [TextContent(type="text", text=json.dumps(result))]
  • Classification of add_episode as SIMPLE complexity task for model routing and cost optimization in enhanced server.
    "add_episode": TaskComplexity.SIMPLE,
    "search_episodes": TaskComplexity.SIMPLE,
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Add knowledge episode to memory' implies a write operation, but it doesn't specify permissions needed, whether this is idempotent, how conflicts are handled, or what the response looks like. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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 a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it immediately understandable. Every word earns its place without redundancy or unnecessary elaboration.

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

Completeness2/5

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

Given this is a mutation tool (adding to memory) with no annotations and no output schema, the description is incomplete. It doesn't explain what happens after adding—whether it returns a confirmation, an ID, or nothing—nor does it cover error conditions or prerequisites. For a tool that modifies state, more context is needed.

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 schema already documents all three parameters (content, name, source) with descriptions. The tool description adds no additional parameter semantics beyond what's in the schema. With high schema coverage, the baseline score of 3 is appropriate as the schema does the heavy lifting.

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 verb ('add') and resource ('knowledge episode to memory'), making the purpose understandable. However, it doesn't distinguish this tool from potential siblings like 'search_episodes' or 'list_recent', which could also interact with memory episodes. The description is specific but lacks sibling differentiation.

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 alternatives. With siblings like 'search_episodes' and 'list_recent' that likely read rather than add episodes, there's an opportunity to clarify usage contexts, but the description offers no such direction. It's a basic statement of function without contextual guidance.

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/airmcp-com/mcp-standards'

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