search_liquid_docs
Search Shopify Liquid documentation for tags, filters, and objects to assist with theme development and Liquid templating.
Instructions
Search Shopify Liquid documentation using full-text search.
Args: queries: List of search terms (maximum 3)
Returns: Formatted search results with snippets
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| queries | Yes |
Implementation Reference
- shopify_liquid_mcp/server.py:22-54 (handler)The main handler function for the 'search_liquid_docs' tool, decorated with @mcp.tool() for registration. It validates input, calls the search_documentation helper, and formats the output results with titles, categories, paths, and snippets.@mcp.tool() def search_liquid_docs(queries: List[str]) -> str: """Search Shopify Liquid documentation using full-text search. Args: queries: List of search terms (maximum 3) Returns: Formatted search results with snippets """ if not queries: return "Error: Please provide at least one search query" # Limit to 3 queries queries = queries[:3] logger.info(f"Searching for: {queries}") results = search_documentation(queries, limit=10) if not results: return f"No results found for: {', '.join(queries)}" # Format results output = [f"Found {len(results)} results for: {', '.join(queries)}\n"] for i, doc in enumerate(results, 1): output.append(f"{i}. **{doc['title']}** ({doc['category']})") output.append(f" Path: {doc['path']}") if doc.get("snippet"): output.append(f" {doc['snippet']}") output.append("") return "\n".join(output)
- shopify_liquid_mcp/ingest.py:201-244 (helper)Supporting helper function that executes the full-text search query on the SQLite FTS5 index, retrieves matching documents with highlighted snippets, and returns structured results used by the tool handler.def search_documentation(queries: List[str], limit: int = 10) -> List[Dict[str, str]]: """Search documentation using FTS5. Args: queries: List of search terms limit: Maximum number of results to return Returns: List of matching documents with metadata """ conn = sqlite3.connect(DB_PATH) cursor = conn.cursor() # Build FTS5 query search_query = " OR ".join(queries[:3]) # Limit to 3 queries like Gemini example cursor.execute( f""" SELECT d.name, d.title, d.category, d.content, d.path, snippet({FTS_TABLE}, 3, '<mark>', '</mark>', '...', 64) as snippet FROM {FTS_TABLE} fts JOIN {DOCS_TABLE} d ON fts.rowid = d.id WHERE {FTS_TABLE} MATCH ? ORDER BY rank LIMIT ? """, (search_query, limit), ) results = [] for row in cursor.fetchall(): results.append( { "name": row[0], "title": row[1], "category": row[2], "content": row[3], "path": row[4], "snippet": row[5], } ) conn.close() return results