Skip to main content
Glama
taylorleese

mcp-toolz

todo_search

Search todo snapshots by content or context to find specific tasks across project sessions using content-based queries.

Instructions

Search todo snapshots by content or context description

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query
project_pathNoFilter by project path
limitNoMaximum number of results

Implementation Reference

  • MCP tool handler for 'todo_search' that extracts parameters, calls storage.search_todo_snapshots, formats results using _format_todo_snapshots_response, and returns TextContent.
    if name == "todo_search":
        query = arguments["query"]
        project_path = arguments.get("project_path")
        limit = arguments.get("limit", 10)
        snapshots = self.storage.search_todo_snapshots(query, project_path=project_path, limit=limit)
        result = self._format_todo_snapshots_response(snapshots)
        return [TextContent(type="text", text=result)]
  • Input schema defining parameters for the todo_search tool: query (required), project_path (optional filter), limit (default 10).
    inputSchema={
        "type": "object",
        "properties": {
            "query": {"type": "string", "description": "Search query"},
            "project_path": {
                "type": "string",
                "description": "Filter by project path",
            },
            "limit": {
                "type": "integer",
                "description": "Maximum number of results",
                "default": 10,
            },
        },
        "required": ["query"],
    },
  • Registration of the 'todo_search' tool in the list_tools() method's return list, including name, description, and schema.
    Tool(
        name="todo_search",
        description="Search todo snapshots by content or context description",
        inputSchema={
            "type": "object",
            "properties": {
                "query": {"type": "string", "description": "Search query"},
                "project_path": {
                    "type": "string",
                    "description": "Filter by project path",
                },
                "limit": {
                    "type": "integer",
                    "description": "Maximum number of results",
                    "default": 10,
                },
            },
            "required": ["query"],
        },
    ),
  • Core helper method implementing the search logic: SQL query with LIKE on 'todos' JSON field and 'context' field, optional project_path filter, ordered by timestamp DESC, limited results, converts rows to TodoListSnapshot objects.
    def search_todo_snapshots(
        self,
        query: str,
        project_path: str | None = None,
        limit: int = 10,
    ) -> list[TodoListSnapshot]:
        """Search todo snapshots by content or context description."""
        sql_query = """
            SELECT * FROM todo_snapshots
            WHERE (
                todos LIKE ? OR
                context LIKE ?
            )
        """
        params: list[Any] = [f"%{query}%", f"%{query}%"]
    
        if project_path:
            sql_query += " AND project_path = ?"
            params.append(project_path)
    
        sql_query += " ORDER BY timestamp DESC LIMIT ?"
        params.append(limit)
    
        with closing(sqlite3.connect(self.db_path)) as conn:
            conn.row_factory = sqlite3.Row
            cursor = conn.execute(sql_query, params)
            return [self._row_to_todo_snapshot(row) for row in cursor.fetchall()]
  • Helper function to format the list of todo snapshots into a readable string response, showing active status, progress, project, ID, timestamp, and context.
    def _format_todo_snapshots_response(self, snapshots: list[Any]) -> str:
        """Format a list of todo snapshots for response."""
        from models import TodoListSnapshot
    
        if not snapshots:
            return "No todo snapshots found."
    
        lines = [f"Found {len(snapshots)} todo snapshots:\n"]
        for snapshot in snapshots:
            if isinstance(snapshot, TodoListSnapshot):
                active_icon = "★" if snapshot.is_active else "○"
                completed = sum(1 for t in snapshot.todos if t.status == "completed")
                total = len(snapshot.todos)
                context_str = f" - {snapshot.context}" if snapshot.context else ""
    
                lines.append(
                    f"{active_icon} {snapshot.timestamp.isoformat()}\n"
                    f"   ID: {snapshot.id}\n"
                    f"   Project: {snapshot.project_path}\n"
                    f"   Progress: {completed}/{total} completed{context_str}\n"
                )
        return "\n".join(lines)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/taylorleese/mcp-toolz'

If you have feedback or need assistance with the MCP directory API, please join our Discord server