get_conversation
Retrieve complete conversation content by ID from indexed AI chat histories. Use after searching to access specific dialogue details.
Instructions
Get the full content of a specific conversation by ID.
Use search_conversations() first to find conversation IDs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| conversation_id | Yes |
Implementation Reference
- The get_conversation tool implementation, which retrieves messages for a specific conversation ID from the database.
@mcp.tool() def get_conversation(conversation_id: str) -> str: """ Get the full content of a specific conversation by ID. Use search_conversations() first to find conversation IDs. """ con = get_conversations() messages = con.execute(""" SELECT role, content, msg_timestamp FROM conversations WHERE conversation_id = ? ORDER BY msg_index ASC """, [conversation_id]).fetchall() if not messages: return f"Conversation not found: {conversation_id}" output = [f"## Conversation ({len(messages)} messages)\n"] for role, content, ts in messages[:20]: output.append(f"### {role.upper()} [{ts}]") output.append(str(content)[:1000] if content else "(empty)") if content and len(str(content)) > 1000: output.append(f"_... ({len(str(content))} chars total)_") output.append("") if len(messages) > 20: output.append(f"_... {len(messages) - 20} more messages_") return "\n".join(output) - brain_mcp/server/tools_conversations.py:10-11 (registration)The registration function where MCP tools (including get_conversation) are registered.
def register(mcp): """Register conversation tools with the MCP server."""