Files
memory-gateway/memory_gateway/mcp_tools_v1.py
2026-05-05 16:18:31 +08:00

136 lines
5.0 KiB
Python

"""MCP tool definitions for the generic Memory Gateway contract.
The legacy MCP endpoint in server.py remains available. These definitions are
the target v1 tool contract for Nanobot, Hermes Agent, OpenClaw, and other
agent frameworks.
"""
MEMORY_GATEWAY_MCP_TOOLS = [
{
"name": "memory_search",
"description": "Search accessible memories with user/agent/workspace/session isolation.",
"inputSchema": {
"type": "object",
"properties": {
"user_id": {"type": "string"},
"agent_id": {"type": "string"},
"workspace_id": {"type": "string"},
"session_id": {"type": "string"},
"query": {"type": "string"},
"namespaces": {"type": "array", "items": {"type": "string"}},
"limit": {"type": "integer", "default": 10},
},
"required": ["user_id", "query"],
},
},
{
"name": "memory_upsert",
"description": "Create or update a memory record after ACL and namespace routing.",
"inputSchema": {
"type": "object",
"properties": {
"user_id": {"type": "string"},
"agent_id": {"type": "string"},
"workspace_id": {"type": "string"},
"session_id": {"type": "string"},
"namespace": {"type": "string"},
"memory_type": {"type": "string"},
"content": {"type": "string"},
"summary": {"type": "string"},
"tags": {"type": "array", "items": {"type": "string"}},
"importance": {"type": "number"},
"confidence": {"type": "number"},
"visibility": {"type": "string"},
},
"required": ["user_id", "content"],
},
},
{
"name": "memory_append_episode",
"description": "Append temporary episode/session memory without automatically promoting it.",
"inputSchema": {
"type": "object",
"properties": {
"user_id": {"type": "string"},
"agent_id": {"type": "string"},
"workspace_id": {"type": "string"},
"session_id": {"type": "string"},
"content": {"type": "string"},
"events": {"type": "array", "items": {"type": "object"}},
"tags": {"type": "array", "items": {"type": "string"}},
},
"required": ["user_id", "session_id", "content"],
},
},
{
"name": "memory_commit_session",
"description": "Promote selected session memories into long-term memory via consolidation.",
"inputSchema": {
"type": "object",
"properties": {
"user_id": {"type": "string"},
"agent_id": {"type": "string"},
"workspace_id": {"type": "string"},
"session_id": {"type": "string"},
"promote": {"type": "boolean", "default": True},
"min_importance": {"type": "number", "default": 0.6},
},
"required": ["user_id", "session_id"],
},
},
{
"name": "memory_get_profile",
"description": "Get the effective user profile memory.",
"inputSchema": {
"type": "object",
"properties": {"user_id": {"type": "string"}},
"required": ["user_id"],
},
},
{
"name": "memory_list_namespaces",
"description": "List namespaces visible to the current user/agent/workspace context.",
"inputSchema": {
"type": "object",
"properties": {
"user_id": {"type": "string"},
"agent_id": {"type": "string"},
"workspace_id": {"type": "string"},
"session_id": {"type": "string"},
},
"required": ["user_id"],
},
},
{
"name": "memory_delete",
"description": "Delete or archive a memory record if the caller has access.",
"inputSchema": {
"type": "object",
"properties": {
"user_id": {"type": "string"},
"agent_id": {"type": "string"},
"workspace_id": {"type": "string"},
"memory_id": {"type": "string"},
},
"required": ["user_id", "memory_id"],
},
},
{
"name": "memory_feedback",
"description": "Attach quality feedback to a memory record for pruning/merge decisions.",
"inputSchema": {
"type": "object",
"properties": {
"user_id": {"type": "string"},
"agent_id": {"type": "string"},
"workspace_id": {"type": "string"},
"memory_id": {"type": "string"},
"feedback": {"type": "string"},
"comment": {"type": "string"},
},
"required": ["user_id", "memory_id", "feedback"],
},
},
]