list_prestashop_docs
Browse and filter PrestaShop documentation by type and category to find development resources, hooks, APIs, and guides.
Instructions
List PrestaShop documentation files.
Args: doc_type: Filter by type: hook, guide, tutorial, api, reference, component, faq, general category: Filter by category: basics, development, modules, themes, etc.
Returns: List of available documents
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc_type | No | ||
| category | No |
Implementation Reference
- prestashop_mcp/server.py:277-319 (handler)The primary handler function for the 'list_prestashop_docs' tool. It is registered via @mcp.tool() decorator, invokes the list_documents helper, groups results by category, limits output per category, and returns a formatted markdown list.@mcp.tool() def list_prestashop_docs( doc_type: Optional[str] = None, category: Optional[str] = None ) -> str: """List PrestaShop documentation files. Args: doc_type: Filter by type: hook, guide, tutorial, api, reference, component, faq, general category: Filter by category: basics, development, modules, themes, etc. Returns: List of available documents """ logger.info(f"Listing documents (type={doc_type}, category={category})") docs = list_documents(doc_type=doc_type, category=category, limit=50) if not docs: return "No documents found matching the filters" # Group by category by_category = {} for doc in docs: cat = doc['category'] if cat not in by_category: by_category[cat] = [] by_category[cat].append(doc) output = [f"Available PrestaShop Documentation ({len(docs)} documents)\n"] for category, category_docs in sorted(by_category.items()): output.append(f"## {category.title()} ({len(category_docs)} docs)\n") for doc in category_docs[:20]: # Limit to 20 per category subcat = f" / {doc['subcategory']}" if doc.get('subcategory') else "" output.append(f"- **{doc['title']}** ({doc['doc_type']}){subcat}") output.append(f" Path: {doc['path']}") if len(category_docs) > 20: output.append(f"\n ... and {len(category_docs) - 20} more documents") output.append("") return "\n".join(output)
- prestashop_mcp/search_v2.py:142-204 (helper)Core helper function that executes the SQL query against the SQLite database (prestashop_docs table) to retrieve the list of documents matching the filters, returning metadata like title, path, category, etc.def list_documents( doc_type: Optional[str] = None, category: Optional[str] = None, limit: int = 50 ) -> List[Dict]: """List documents with optional filters. Args: doc_type: Filter by document type category: Filter by category limit: Maximum number of results Returns: List of documents (summary only) """ conn = sqlite3.connect(DB_PATH) cursor = conn.cursor() # Build WHERE clause filters = [] params = [] if doc_type: filters.append("doc_type = ?") params.append(doc_type) if category: filters.append("category = ?") params.append(category) where_clause = "" if filters: where_clause = f"WHERE {' AND '.join(filters)}" query_sql = f""" SELECT name, title, category, subcategory, doc_type, path FROM prestashop_docs {where_clause} ORDER BY category, subcategory, title LIMIT ? """ params.append(limit) try: cursor.execute(query_sql, params) results = [] for row in cursor.fetchall(): results.append({ "name": row[0], "title": row[1], "category": row[2], "subcategory": row[3], "doc_type": row[4], "path": row[5] }) return results finally: conn.close()