Skip to main content
Glama

get_prestashop_stats

Retrieve statistics about indexed PrestaShop documentation including document counts, types, categories, and specialized data for development reference.

Instructions

Get statistics about indexed PrestaShop documentation.

Returns: Statistics about documents, types, categories, and specialized data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The primary MCP tool handler for get_prestashop_stats. Decorated with @mcp.tool() for registration. Fetches stats from helper and formats as Markdown report.
    @mcp.tool()
    def get_prestashop_stats() -> str:
        """Get statistics about indexed PrestaShop documentation.
    
        Returns:
            Statistics about documents, types, categories, and specialized data
        """
        logger.info("Getting documentation statistics")
        stats = get_stats()
    
        output = ["# PrestaShop Documentation Statistics\n"]
    
        output.append(f"**Total Documents:** {stats['total_documents']}\n")
    
        output.append("## By Document Type\n")
        for doc_type, count in sorted(stats['by_type'].items(), key=lambda x: x[1], reverse=True):
            output.append(f"- {doc_type}: {count}")
        output.append("")
    
        output.append("## By Category\n")
        for category, count in sorted(stats['by_category'].items(), key=lambda x: x[1], reverse=True):
            output.append(f"- {category}: {count}")
        output.append("")
    
        output.append("## Specialized Data\n")
        output.append(f"- Domain References (CQRS): {stats['domain_references']}")
        output.append(f"- UI Components: {stats['components']}")
    
        return "\n".join(output)
  • Core helper function that queries the SQLite database (prestashop_docs.db) to compute and return statistics: total docs, grouped by type and category, plus counts for domain_references and components tables.
    def get_stats() -> Dict:
        """Get documentation statistics.
    
        Returns:
            Statistics about indexed documentation
        """
        conn = sqlite3.connect(DB_PATH)
        cursor = conn.cursor()
    
        try:
            # Total documents
            cursor.execute("SELECT COUNT(*) FROM prestashop_docs")
            total_docs = cursor.fetchone()[0]
    
            # By document type
            cursor.execute("""
                SELECT doc_type, COUNT(*) as count
                FROM prestashop_docs
                GROUP BY doc_type
                ORDER BY count DESC
            """)
            by_type = {row[0]: row[1] for row in cursor.fetchall()}
    
            # By category
            cursor.execute("""
                SELECT category, COUNT(*) as count
                FROM prestashop_docs
                GROUP BY category
                ORDER BY count DESC
            """)
            by_category = {row[0]: row[1] for row in cursor.fetchall()}
    
            # Domain references
            cursor.execute("SELECT COUNT(*) FROM domain_references")
            domain_refs = cursor.fetchone()[0]
    
            # Components
            cursor.execute("SELECT COUNT(*) FROM components")
            components = cursor.fetchone()[0]
    
            return {
                "total_documents": total_docs,
                "by_type": by_type,
                "by_category": by_category,
                "domain_references": domain_refs,
                "components": components
            }
    
        finally:
            conn.close()

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/florinel-chis/prestashop-mcp'

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