Skip to main content
Glama

delete_episode

Remove specific episodes from graph memory by providing their UUID to manage document content efficiently.

Instructions

Delete an episode from the graph memory.

Args:
    uuid: UUID of the episode to delete

Returns:
    Success message dictionary

Example:
    delete_episode(uuid="episode-uuid-123")

@REQ: REQ-graphiti-chunk-mcp
@BP: BP-graphiti-chunk-mcp
@TASK: TASK-007-MCPTools

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uuidYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler and registration for 'delete_episode'. This decorated function is the entry point for the tool, defining input schema via signature/docstring and delegating to the implementation.
    @mcp.tool()
    async def delete_episode(uuid: str) -> Dict[str, str]:
        """
        Delete an episode from the graph memory.
    
        Args:
            uuid: UUID of the episode to delete
    
        Returns:
            Success message dictionary
    
        Example:
            delete_episode(uuid="episode-uuid-123")
    
        @REQ: REQ-graphiti-chunk-mcp
        @BP: BP-graphiti-chunk-mcp
        @TASK: TASK-007-MCPTools
        """
        return await graphiti_tools.delete_episode_impl(uuid=uuid)
  • Core implementation of delete_episode logic. Creates GraphitiClient instance and calls its delete_episode method, handles errors with ToolError.
    async def delete_episode_impl(uuid: str) -> Dict[str, str]:
        """
        Delete an episode from the graph memory.
    
        @REQ: REQ-graphiti-chunk-mcp
        @BP: BP-graphiti-chunk-mcp
        @TASK: TASK-007-MCPTools
    
        Args:
            uuid: UUID of the episode to delete
    
        Returns:
            Success message dictionary
    
        Raises:
            ToolError: If deletion operation fails
        """
        try:
            client = get_graphiti_client()
            async with client:
                await client.delete_episode(uuid)
                return {"message": f"Successfully deleted episode {uuid}"}
    
        except Exception as e:
            raise ToolError(
                "DELETE_EPISODE_ERROR",
                f"Failed to delete episode: {str(e)}"
            ) from e
  • GraphitiClient helper method that performs the actual episode deletion by calling the underlying Graphiti instance's remove_episode method.
    async def delete_episode(self, episode_uuid: str) -> bool:
        """
        Delete an episode from Graphiti by its UUID.
    
        @REQ: REQ-graphiti-chunk-mcp
        @BP: BP-graphiti-chunk-mcp
        @TASK: TASK-005-GraphitiClient
    
        Args:
            episode_uuid: UUID of the episode to delete
    
        Returns:
            True if deletion was successful
    
        Raises:
            RuntimeError: If deletion fails
        """
        try:
            logger.debug(f"Deleting episode: {episode_uuid}")
    
            await self.graphiti.remove_episode(episode_uuid)
    
            logger.info(f"Episode deleted successfully: {episode_uuid}")
            return True
    
        except Exception as e:
            logger.error(f"Failed to delete episode {episode_uuid}: {e}")
            raise RuntimeError(f"Failed to delete episode: {e}") from e
  • Initialization of the FastMCP server instance where all tools including delete_episode are registered.
    mcp = FastMCP("graphiti-memory-server")
  • Input/output schema defined by function signature and docstring for the delete_episode tool.
    async def delete_episode(uuid: str) -> Dict[str, str]:
        """
        Delete an episode from the graph memory.
    
        Args:
            uuid: UUID of the episode to delete
    
        Returns:
            Success message dictionary
    
        Example:
            delete_episode(uuid="episode-uuid-123")
    
        @REQ: REQ-graphiti-chunk-mcp
        @BP: BP-graphiti-chunk-mcp
        @TASK: TASK-007-MCPTools
        """
        return await graphiti_tools.delete_episode_impl(uuid=uuid)
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. It states the tool deletes an episode, implying a destructive mutation, but doesn't cover critical aspects like whether deletion is permanent, requires specific permissions, has side effects on related graph elements, or handles invalid UUIDs. The mention of a 'Success message dictionary' return is minimal behavioral context.

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 well-structured and appropriately sized, with a clear purpose statement, parameter explanation, return note, and example. Every sentence adds value, and it's front-loaded with the core action. Minor trimming of meta-tags like '@REQ' could improve conciseness, but overall it's efficient.

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?

Given the tool's complexity (destructive operation with 1 parameter) and the presence of an output schema (which handles return values), the description is moderately complete. It covers the basic purpose and parameter semantics but lacks usage guidelines, detailed behavioral context (e.g., deletion permanence), and integration with sibling tools, leaving gaps for an AI agent.

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?

The description adds significant value beyond the input schema, which has 0% description coverage. It explains that 'uuid' is the 'UUID of the episode to delete', clarifying the parameter's purpose and format, and provides an example with a sample UUID. This compensates well for the schema's lack of documentation, though it could elaborate on UUID format constraints.

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 action ('Delete') and resource ('an episode from the graph memory'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'clear_graph' (which might delete all episodes) or 'delete_entity_edge' (which deletes different graph elements), so it misses full sibling distinction.

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. For example, it doesn't mention when to choose 'delete_episode' over 'clear_graph' for bulk deletion or how it relates to 'get_episodes' for verification. There's also no mention of prerequisites or error conditions.

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/leo7nel23/KnowkedgeSmith-MCP'

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