context_delete
Remove specific context entries by ID to manage stored session data and maintain organized workspace resources.
Instructions
Delete a specific context by ID
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context_id | Yes | Context ID to delete |
Input Schema (JSON Schema)
{
"properties": {
"context_id": {
"description": "Context ID to delete",
"type": "string"
}
},
"required": [
"context_id"
],
"type": "object"
}
Implementation Reference
- src/mcp_server/server.py:419-424 (handler)Handler in call_tool method that executes the context_delete tool by extracting context_id and calling storage.delete_context, returning success or not found message.if name == "context_delete": context_id = arguments["context_id"] deleted = self.storage.delete_context(context_id) if deleted: return [TextContent(type="text", text=f"ā Context {context_id} deleted")] return [TextContent(type="text", text=f"Context {context_id} not found")]
- src/mcp_server/server.py:163-173 (schema)Tool schema definition including input schema for context_delete in list_tools method.Tool( name="context_delete", description="Delete a specific context by ID", inputSchema={ "type": "object", "properties": { "context_id": {"type": "string", "description": "Context ID to delete"}, }, "required": ["context_id"], }, ),
- Core helper method in ContextStorage that performs the actual database deletion of the context by ID.def delete_context(self, context_id: str) -> bool: """Delete a context by ID. Returns True if deleted, False if not found.""" with closing(sqlite3.connect(self.db_path)) as conn: cursor = conn.execute("DELETE FROM contexts WHERE id = ?", (context_id,)) conn.commit() return cursor.rowcount > 0