Skip to main content
Glama

get_liquid_object

Retrieve complete documentation for Shopify Liquid objects like 'product', 'cart', or 'shop' to understand their properties and usage in theme development.

Instructions

Get documentation for a specific Shopify Liquid object.

Args: object_name: Name of the object (e.g., 'product', 'cart', 'shop')

Returns: Complete object documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
object_nameYes

Implementation Reference

  • The main handler function for the get_liquid_object tool. It takes an object_name parameter, retrieves the corresponding documentation using get_document('objects', object_name), and returns the content or an error message if not found. The docstring defines the input/output schema.
    @mcp.tool()
    def get_liquid_object(object_name: str) -> str:
        """Get documentation for a specific Shopify Liquid object.
    
        Args:
            object_name: Name of the object (e.g., 'product', 'cart', 'shop')
    
        Returns:
            Complete object documentation
        """
        doc = get_document("objects", object_name)
    
        if not doc:
            return f"Object '{object_name}' not found. Use list_liquid_objects() to see available objects."
    
        return doc["content"]
  • Helper function that queries the SQLite database to retrieve a specific document by category and name. Called by the handler with category='objects'.
    def get_document(category: str, name: str) -> Dict[str, str] | None:
        """Get a specific document.
    
        Args:
            category: Category name (tags, filters, or objects)
            name: Document name
    
        Returns:
            Document data or None if not found
        """
        conn = sqlite3.connect(DB_PATH)
        cursor = conn.cursor()
    
        cursor.execute(
            f"""
            SELECT name, title, category, content, path
            FROM {DOCS_TABLE}
            WHERE category = ? AND name = ?
        """,
            (category, name),
        )
    
        row = cursor.fetchone()
        conn.close()
    
        if row:
            return {
                "name": row[0],
                "title": row[1],
                "category": row[2],
                "content": row[3],
                "path": row[4],
            }
        return None

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/shopify-liquid-mcp'

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