from mcp.types import Tool


MEMORY_SEARCH_TOOLS = [
    Tool(
        name = 'basic_memory_search',
        description = 'Performs a comprehensive memory search with optional filtering by focus, time scope, and group IDs.',
        inputSchema = {
            "type": "object",
            "properties": {
            "query": {
                "type": "string",
                "description": "The search query to retrieve memory content."
            },
            "group_ids": {
                "type": "array",
                "items": { "type": "string" },
                "description": "Optional list of group IDs to restrict the search scope."
            },
            "search_focus": {
                "type": "string",
                "enum": ["comprehensive", "facts_only", "entities_only", "conversations_only"],
                "description": "Specifies the type of results to prioritize in the search."
            },
            "time_scope": {
                "type": "string",
                "enum": ["all_time", "recent", "very_recent"],
                "description": "Time filter to scope the search (e.g., recent = last 30 days)."
            },
            "max_results": {
                "type": "integer",
                "description": "Maximum number of search results to return.",
                "default": 15
            },
            "center_around": {
                "type": "string",
                "description": "Optional node UUID to center the search context."
            }
            },
            "required": ["query"]
        }
    ),
    Tool(
        name = 'advanced_memory_search',
        description = 'Executes a configurable memory search using ranking strategy, relationship context, and time constraints.',
        inputSchema = {
            "type": "object",
            "properties": {
            "query": {
                "type": "string",
                "description": "The search query for memory."
            },
            "group_ids": {
                "type": "array",
                "items": { "type": "string" },
                "description": "Optional list of group IDs to limit search scope."
            },
            "ranking_strategy": {
                "type": "string",
                "enum": ["most_accurate", "balanced_ranking", "diverse_perspectives", "proximity_focused", "recent_mentions"],
                "description": "Ranking logic for prioritizing results."
            },
            "search_focus": {
                "type": "string",
                "enum": ["comprehensive", "facts_only", "entities_only", "conversations_only"],
                "description": "Specifies the type of results to emphasize."
            },
            "reference_point": {
                "type": "string",
                "description": "Node UUID to anchor the search, if applicable."
            },
            "time_constraints": {
                "type": "object",
                "properties": {
                "start_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Start datetime in ISO format (e.g. 2024-01-01T00:00:00Z)"
                },
                "end_date": {
                    "type": "string",
                    "format": "date-time",
                    "description": "End datetime in ISO format (e.g. 2024-01-30T23:59:59Z)"
                }
                }
            },
            "max_results": {
                "type": "integer",
                "description": "Limit for number of results returned.",
                "default": 25
            }
            },
            "required": ["query"]
        }
    ),
    Tool(
        name = 'get_recent_conversations',
        description = 'Retrieves the most recent conversational episodes from memory, filtered by group IDs.',
        inputSchema = {
            "type": "object",
            "properties": {
            "last_n": {
                "type": "integer",
                "description": "Number of most recent episodes to fetch.",
                "default": 10
            },
            "group_ids": {
                "type": "array",
                "items": { "type": "string" },
                "description": "list of group IDs to constrain retrieval scope."
            }
            },
            "required": ["group_ids"]
        } 
    ),
    Tool(
        name = 'get_session_history',
        description = 'Retrieves the full conversation history for a specific session, filtered by session ID.',
        inputSchema = {
            "type": "object",
            "properties": {
                "session_id": {
                    "type": "string",
                    "description": "The ID of the session to retrieve history for."
                }
            },
            "required": ["session_id"]
        }
    )
]