Skip to main content
Glama

search_clipboard

Search clipboard history for text snippets you copied earlier. Enter a query to find matching entries with timestamps and source applications. Retrieve specific information like bug IDs or quotes without manually scrolling through history.

Instructions

Full-text search over the clipboard history.

Returns matching entries with timestamp, snippet, and source application.

USE WHEN: the user asks "find that thing I copied about X" / "did I copy the bug ID." NOT FOR: non-text clipboard content — only text entries are indexed.

BEHAVIOR: pure read. Sensitive entries are excluded from the index (see get_clipboard_history).

PARAMETERS: query: substring or FTS expression. Required, non-empty. limit: max results. Range 1-100. Default 20.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler that searches clipboard history by text query. Decorated with @mcp_app.tool() and @_track_call. Clamps minutes_ago to [1,10080], validates query, delegates DB search to _activity_db.search_clipboard(), formats results as a formatted string with timestamps and previews.
    @mcp_app.tool()
    @_track_call
    def search_clipboard(query: str, minutes_ago: int = 60) -> str:
        """Search clipboard history for specific text.
    
        Searches through captured clipboard contents. Useful for finding a
        specific error message, URL, or code snippet that was copied earlier.
    
        Args:
            query: Text to search for in clipboard history.
            minutes_ago: How far back to search (default 60 minutes).
        """
        minutes_ago = max(1, min(minutes_ago, 10080))
        if not query or not query.strip():
            return "Search query cannot be empty."
        results = _activity_db.search_clipboard(query, minutes_ago)
        if not results:
            return f"No clipboard entries matching '{query}' in the last {minutes_ago} minutes."
    
        lines = [f"=== Clipboard Search: '{query}' ({len(results)} results) ===\n"]
        for entry in results:
            ts_str = datetime.fromtimestamp(entry["timestamp"]).strftime("%H:%M:%S")
            text = entry["text"]
            preview = text[:300].replace("\n", " \\n ")
            if len(text) > 300:
                preview += "..."
            lines.append(f"[{ts_str}] ({len(text)} chars)")
            lines.append(f"  {preview}")
            lines.append("")
    
        return "\n".join(lines)
  • SQLite-backed helper method ActivityDB.search_clipboard() that performs a LIKE query on the clipboard table, filtering by text match and timestamp cutoff, returning up to 20 results as dicts.
    def search_clipboard(self, query: str, minutes_ago: int = 60) -> list[dict]:
        """Search clipboard history by text content."""
        cutoff = time.time() - (minutes_ago * 60)
        like_query = f"%{query}%"
        with self._lock:
            rows = self._conn.execute(
                "SELECT id, timestamp, text FROM clipboard "
                "WHERE text LIKE ? AND timestamp >= ? "
                "ORDER BY timestamp DESC LIMIT 20",
                (like_query, cutoff),
            ).fetchall()
        return [dict(row) for row in rows]
  • Tool registration via @mcp_app.tool() decorator on the search_clipboard function in the ContextPulse Sight MCP server.
    @mcp_app.tool()
    @_track_call
    def search_clipboard(query: str, minutes_ago: int = 60) -> str:
        """Search clipboard history for specific text.
    
        Searches through captured clipboard contents. Useful for finding a
        specific error message, URL, or code snippet that was copied earlier.
    
        Args:
            query: Text to search for in clipboard history.
            minutes_ago: How far back to search (default 60 minutes).
        """
        minutes_ago = max(1, min(minutes_ago, 10080))
        if not query or not query.strip():
            return "Search query cannot be empty."
        results = _activity_db.search_clipboard(query, minutes_ago)
        if not results:
            return f"No clipboard entries matching '{query}' in the last {minutes_ago} minutes."
    
        lines = [f"=== Clipboard Search: '{query}' ({len(results)} results) ===\n"]
        for entry in results:
            ts_str = datetime.fromtimestamp(entry["timestamp"]).strftime("%H:%M:%S")
            text = entry["text"]
            preview = text[:300].replace("\n", " \\n ")
            if len(text) > 300:
                preview += "..."
            lines.append(f"[{ts_str}] ({len(text)} chars)")
            lines.append(f"  {preview}")
            lines.append("")
    
        return "\n".join(lines)
  • Input schema: query (str, required), minutes_ago (int, default 60). Output is a formatted str.
    def search_clipboard(query: str, minutes_ago: int = 60) -> str:
        """Search clipboard history for specific text.
    
        Searches through captured clipboard contents. Useful for finding a
        specific error message, URL, or code snippet that was copied earlier.
    
        Args:
            query: Text to search for in clipboard history.
            minutes_ago: How far back to search (default 60 minutes).
        """
  • Glama.ai registry stub for search_clipboard — returns _LOCAL_ONLY_MSG because ContextPulse only runs locally; this is just for registry discovery.
    @mcp_app.tool()
    def search_clipboard(query: str, limit: int = 20) -> str:
        """Full-text search over the clipboard history.
    
        Returns matching entries with timestamp, snippet, and source application.
    
        USE WHEN: the user asks "find that thing I copied about X" / "did I copy
        the bug ID."
        NOT FOR: non-text clipboard content — only text entries are indexed.
    
        BEHAVIOR: pure read. Sensitive entries are excluded from the index (see
        get_clipboard_history).
    
        PARAMETERS:
          query: substring or FTS expression. Required, non-empty.
          limit: max results. Range 1-100. Default 20.
        """
        return _LOCAL_ONLY_MSG
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description declares the tool as 'pure read' and mentions that sensitive entries are excluded from the index, referencing get_clipboard_history for details. While this covers key behavioral traits, additional info on performance or pagination would enhance transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with clear section headers (USE WHEN, NOT FOR, BEHAVIOR, PARAMETERS). Every sentence adds value and the total length is appropriate for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the output schema exists (though not shown), the description specifies return fields (timestamp, snippet, source application) and covers the key constraint (text-only, sensitive exclusion). For a search tool, this is complete and actionable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description adds critical meaning: query can be a 'substring or FTS expression', is required and non-empty; limit specifies 'max results', range '1-100', and default 20. This goes well beyond the raw schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool performs 'Full-text search over the clipboard history' and lists the returned fields (timestamp, snippet, source application). This verb+resource combination distinguishes it from siblings like get_clipboard_history and search_history.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit 'USE WHEN' and 'NOT FOR' sections with examples (e.g., 'find that thing I copied about X', 'did I copy the bug ID'), and clarifies that only text entries are indexed, effectively guiding the agent on appropriate use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/ContextPulse/contextpulse'

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