search_transcripts_tool
Search all podcast transcripts for specific terms or phrases. Returns matching episodes with highlighted snippets. Supports quoted exact matches, AND/OR logic, and prefix wildcards like 'retain*'.
Instructions
Full-text search across all transcript content. Returns matching episodes with highlighted snippets. Supports quoted phrases, AND/OR operators, and prefix wildcards (e.g. 'retain*').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| limit | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- MCP tool handler that performs full-text search across all transcript content using FTS5. It delegates to search_episodes() and formats results with highlighted snippets.
@mcp.tool() def search_transcripts_tool(query: str, limit: int = 5) -> str: """ Full-text search across all transcript content. Returns matching episodes with highlighted snippets. Supports quoted phrases, AND/OR operators, and prefix wildcards (e.g. 'retain*'). """ conn = _get_conn() results = search_episodes(conn, query, limit) if not results: return "No results found." parts = [f"## {r['name']}\n{r['snippet']}" for r in results] return f"Found {len(results)} result(s) for '{query}':\n\n" + "\n\n---\n\n".join(parts) - src/dropbox_transcripts_mcp/server.py:83-83 (registration)Registration via the @mcp.tool() decorator on a FastMCP instance, which registers the function as an MCP tool.
@mcp.tool() - Helper function that executes the FTS5 search query on the episodes_fts virtual table, returning episode names and highlighted snippets.
def search_episodes(conn: sqlite3.Connection, query: str, limit: int = 5) -> list[dict]: rows = conn.execute( """ SELECT e.name, snippet(episodes_fts, 1, '[', ']', '...', 40) AS snippet FROM episodes_fts JOIN episodes e ON e.id = episodes_fts.rowid WHERE episodes_fts MATCH ? ORDER BY rank LIMIT ? """, (query, limit), ).fetchall() return [dict(r) for r in rows]