Skip to content

Conversation

Ryado
Copy link
Contributor

@Ryado Ryado commented Sep 8, 2025

⚠️ This is an experiment and not ready to be merged.

This PR introduces experimental memory management tools that allow storing and retrieving key-value data using ClickHouse as the backend storage.

New Tools Added

  • save_memory: Store user-provided information as key-value pairs
  • get_memories_titles: Retrieve all memory keys/titles with timestamps
  • get_memory: Retrieve all memory entries matching a specific key
  • get_all_memories: Retrieve all saved memories (use with caution for large datasets)
  • delete_memory: Delete all memory entries matching a specific key

Implementation Details

  • Memory data is stored in a user_memory table with automatic timestamps
  • Tools are conditionally registered based on CLICKHOUSE_MEMORY environment variable
  • Uses existing ClickHouse write query functionality for persistence
  • Includes comprehensive test coverage for all memory operations
  • Follows existing error handling patterns with structured responses
screen_record.mp4

@Ryado Ryado added the enhancement New feature or request label Sep 8, 2025
@mshustov mshustov requested a review from Copilot October 7, 2025 08:01
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces experimental memory management functionality that allows storing and retrieving key-value data using ClickHouse as the backend storage. The feature is controlled by the CLICKHOUSE_MEMORY environment variable and provides a set of tools for persistent memory operations.

Key changes:

  • Add five new memory management tools: save_memory, get_memories_titles, get_memory, get_all_memories, and delete_memory
  • Implement conditional tool registration based on CLICKHOUSE_MEMORY environment variable
  • Add comprehensive test coverage for all memory operations

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mcp_clickhouse/mcp_env.py Adds memory_enabled property to configuration for controlling memory tool availability
mcp_clickhouse/mcp_server.py Implements memory management functions and conditional tool registration
tests/test_tool.py Adds comprehensive test suite for memory functionality
pyproject.toml Adds pytest development dependency
README.md Documents the new experimental memory tools and configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.



def delete_memory(key: str):
"""Delete all memory entries matching the specified key from the user memory table. Warining this tool should only be used when explicitly requested by the user"""
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'Warining' to 'Warning'.

Suggested change
"""Delete all memory entries matching the specified key from the user memory table. Warining this tool should only be used when explicitly requested by the user"""
"""Delete all memory entries matching the specified key from the user memory table. Warning this tool should only be used when explicitly requested by the user"""

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant