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
| Name | Required | Description | Default |
|---|---|---|---|
| uuid | Yes |
Implementation Reference
- rbt_mcp_server/server.py:136-154 (handler)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)
- rbt_mcp_server/graphiti_tools.py:198-225 (handler)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
- rbt_mcp_server/server.py:20-20 (registration)Initialization of the FastMCP server instance where all tools including delete_episode are registered.mcp = FastMCP("graphiti-memory-server")
- rbt_mcp_server/server.py:137-154 (schema)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)