Skip to main content
Glama
florinel-chis

Magento 2 GraphQL Documentation MCP Server

search_documentation

Search Magento 2 GraphQL documentation using short keyword queries. Filter results by category, subcategory, or content type to find relevant guides, references, and tutorials.

Instructions

Search Magento 2 GraphQL documentation by keywords. Use SHORT keyword queries (1-3 words) to find documentation pages. Can filter by category, subcategory, or content type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queriesYesList of 1-3 short keyword queries. Examples: ['product', 'cart'], ['checkout']
categoryNoFilter by category: schema, develop, usage, tutorials, payment-methods
subcategoryNoFilter by subcategory: products, cart, customer, checkout, etc.
content_typeNoFilter by content type: guide, reference, tutorial, schema

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The `search_documentation` function that executes the tool logic. It accepts a list of keyword queries, optional category/subcategory/content_type filters, performs FTS search on the SQLite database, applies filters, and returns formatted results.
    def search_documentation(
        queries: Annotated[
            List[str],
            Field(description="List of 1-3 short keyword queries. Examples: ['product', 'cart'], ['checkout']")
        ],
        category: Annotated[
            Optional[str],
            Field(description="Filter by category: schema, develop, usage, tutorials, payment-methods")
        ] = None,
        subcategory: Annotated[
            Optional[str],
            Field(description="Filter by subcategory: products, cart, customer, checkout, etc.")
        ] = None,
        content_type: Annotated[
            Optional[str],
            Field(description="Filter by content type: guide, reference, tutorial, schema")
        ] = None
    ) -> str:
  • The function's Pydantic-style annotated parameters define the input schema: 'queries' (List[str]), 'category' (Optional[str]), 'subcategory' (Optional[str]), 'content_type' (Optional[str]) with Field descriptions.
    def search_documentation(
        queries: Annotated[
            List[str],
            Field(description="List of 1-3 short keyword queries. Examples: ['product', 'cart'], ['checkout']")
        ],
        category: Annotated[
            Optional[str],
            Field(description="Filter by category: schema, develop, usage, tutorials, payment-methods")
        ] = None,
        subcategory: Annotated[
            Optional[str],
            Field(description="Filter by subcategory: products, cart, customer, checkout, etc.")
        ] = None,
        content_type: Annotated[
            Optional[str],
            Field(description="Filter by content type: guide, reference, tutorial, schema")
        ] = None
    ) -> str:
  • The tool is registered via the @mcp.tool() decorator with name='search_documentation' and a description explaining usage for searching Magento 2 GraphQL documentation.
    @mcp.tool(
        name="search_documentation",
        description="""Search Magento 2 GraphQL documentation by keywords.
    Use SHORT keyword queries (1-3 words) to find documentation pages.
    Can filter by category, subcategory, or content type."""
    )
  • Configuration constants used by the handler: DB_TOP_K (default 5) limits results, SEARCH_RESULT_MULTIPLIER (2) fetches extra results before filtering to allow for category/subcategory/content_type filters.
    # Configurable constants
    DB_TOP_K = int(os.environ.get("MAGENTO_GRAPHQL_DOCS_TOP_K", "5"))
    MAX_FIELDS_PER_ELEMENT = int(os.environ.get("MAGENTO_GRAPHQL_DOCS_MAX_FIELDS", "20"))
    MAX_CODE_PREVIEW_LENGTH = int(os.environ.get("MAGENTO_GRAPHQL_DOCS_CODE_PREVIEW", "400"))
    SEARCH_RESULT_MULTIPLIER = 2  # Fetch 2x results before filtering
  • The get_db_path() helper that provides the DB_PATH used by the handler to open the SQLite database for FTS search.
    def get_db_path() -> str:
        """
        Determines the database path.
        Prioritizes MAGENTO_GRAPHQL_DOCS_DB_PATH environment variable.
        Defaults to ~/.mcp/magento-graphql-docs/database.db.
        Ensures the parent directory exists.
        """
        env_path = os.environ.get("MAGENTO_GRAPHQL_DOCS_DB_PATH")
        if env_path:
            db_path = Path(env_path)
        else:
            db_path = Path.home() / ".mcp" / "magento-graphql-docs" / "database.db"
    
        # Ensure directory exists
        db_path.parent.mkdir(parents=True, exist_ok=True)
    
        return str(db_path)
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses the ability to filter and the keyword length constraint, but does not explain return format, performance, or other behavioral traits. Given the existence of an output schema, this is adequate but not rich.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three short sentences with no filler, front-loaded with the core purpose. Every sentence adds essential information, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the 4-parameter schema and output schema, the description covers the main functionality, search scope, query constraints, and filters. It lacks details on result sorting or case sensitivity, but is largely complete for an agent to use effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds value by specifying the use of short queries (1-3 words) and explicitly mentioning filtering by category, subcategory, and content type, which goes beyond the schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool searches Magento 2 GraphQL documentation by keywords, distinguishing it from sibling tools like search_graphql_elements and search_examples. The verb 'search' and resource 'documentation' are specific, and the mention of short keywords adds further clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly advises using short keyword queries (1-3 words), which guides effective usage. However, it does not explicitly contrast with alternatives or state when not to use the tool, so it lacks full exclusion guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/magento-graphql-docs-mcp'

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