Skip to main content
Glama
yangjeep

Searchspring Integration Assistant

by yangjeep

searchspring_parameter_guide

Understand Searchspring API parameters with detailed explanations, usage examples, and implementation best practices for proper integration.

Instructions

Get detailed explanation for specific API parameters, their usage, and best practices

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apiYesThe Searchspring API containing the parameter
parameterYesThe specific parameter to get guidance for (e.g., 'filters', 'sort', 'tags')

Implementation Reference

  • Core handler function that implements the searchspring_parameter_guide tool logic. Takes api and parameter inputs, looks up detailed guidance from parameterGuides data structure, handles missing params, and returns formatted markdown response with best practices, examples, and documentation links.
      async getParameterGuide(params: ParameterGuideParams) {
        const { api, parameter } = params;
    
        const parameterGuides: Record<string, Record<string, any>> = {
          search: {
            q: {
              description: "Search query string - the terms users want to search for",
              type: "string",
              example: "running shoes",
              bestPractices: [
                "URL encode special characters",
                "Trim whitespace before sending",
                "Consider query preprocessing (stemming, synonyms)",
                "Handle empty queries gracefully"
              ],
              useCases: ["Product search", "Site search", "Autocomplete"],
              relatedParams: ["redirectResponse", "landingPage"]
            },
            filters: {
              description: "Apply filters to search results using filter.{field}=value format",
              type: "object",
              example: "filter.brand=Nike&filter.color=blue&filter.price=50-100",
              bestPractices: [
                "Use exact field names from your product data",
                "For multiple values: filter.brand=Nike&filter.brand=Adidas",
                "For ranges: filter.price=min-max",
                "URL encode filter values"
              ],
              useCases: ["Category filtering", "Faceted navigation", "Price filtering"],
              relatedParams: ["bgfilters", "includedFacets", "excludedFacets"]
            },
            bgfilters: {
              description: "Background filters applied permanently, not visible to users",
              type: "object",
              example: "bgfilter.status=active&bgfilter.visibility=public",
              bestPractices: [
                "Use for system-level filtering (active products, visible items)",
                "Hide discontinued or out-of-stock products",
                "Apply site-specific rules",
                "Don't expose in filter UI"
              ],
              useCases: ["Product visibility", "Inventory filtering", "Site restrictions"],
              relatedParams: ["filters"]
            },
            sort: {
              description: "Sort search results by field and direction",
              type: "object",
              example: "sort.price=asc&sort.popularity=desc",
              bestPractices: [
                "Primary sort first, secondary sort second",
                "Use 'asc' for ascending, 'desc' for descending",
                "Common sorts: price, popularity, title, date",
                "Provide sort options to users"
              ],
              useCases: ["Price sorting", "Popularity sorting", "Name sorting", "Date sorting"],
              relatedParams: ["resultsPerPage", "page"]
            },
            userId: {
              description: "Unique identifier for tracking user behavior - sourced from ssUserId cookie",
              type: "string",
              example: "value from ssUserId cookie",
              bestPractices: [
                "Always get value from ssUserId cookie",
                "Automatically set by Searchspring tracking",
                "Do not manually generate - use cookie value",
                "Required for analytics and personalization"
              ],
              useCases: ["User tracking", "Personalization", "Analytics"],
              relatedParams: ["sessionId", "pageLoadId", "domain"]
            },
            sessionId: {
              description: "Session identifier for tracking user journey - sourced from ssSessionIdNamespace cookie",
              type: "string",
              example: "value from ssSessionIdNamespace cookie",
              bestPractices: [
                "Always get value from ssSessionIdNamespace cookie",
                "Automatically set by Searchspring tracking",
                "Do not manually generate - use cookie value",
                "Used for analytics and behavior tracking"
              ],
              useCases: ["Session tracking", "User journey analysis", "Analytics"],
              relatedParams: ["userId", "pageLoadId"]
            },
            pageLoadId: {
              description: "Unique identifier for each page load/search - should be UUID v4",
              type: "string",
              example: "e560933a-b0fe-408d-8df5-807270e79fb8",
              bestPractices: [
                "Generate new UUID v4 for each page load",
                "Update on every physical page load",
                "For SPA/headless: update on URL route change",
                "Critical for proper analytics tracking"
              ],
              useCases: ["Search tracking", "Click analytics", "Performance monitoring"],
              relatedParams: ["userId", "sessionId", "domain"]
            },
            domain: {
              description: "Current page URL - should be window.location.href",
              type: "string",
              example: "https://yoursite.com/search?q=shoes",
              bestPractices: [
                "Always use window.location.href value",
                "Include full URL with protocol and parameters",
                "Required for proper analytics and personalization",
                "Do not hardcode - get dynamically"
              ],
              useCases: ["Page tracking", "Analytics", "Personalization context"],
              relatedParams: ["userId", "sessionId", "pageLoadId"]
            }
          },
          autocomplete: {
            q: {
              description: "Partial search query for autocomplete suggestions",
              type: "string",
              example: "runn (user typing 'running')",
              bestPractices: [
                "Start suggestions after 2+ characters",
                "Use debouncing (50ms delay recommended by Searchspring)",
                "Handle special characters properly",
                "Clear suggestions when query is empty"
              ],
              useCases: ["Search input autocomplete", "Product suggestions", "Query completion"],
              relatedParams: ["resultsPerPage"]
            }
          },
          recommendations: {
            tags: {
              description: "Recommendation profile tags/IDs that define recommendation types",
              type: "array",
              example: "['similar-products', 'trending', 'recently-viewed']",
              bestPractices: [
                "Use meaningful profile names",
                "Configure profiles in Searchspring dashboard first",
                "Combine multiple recommendation types",
                "Order by priority/importance"
              ],
              useCases: ["Product recommendations", "Cross-selling", "Upselling", "Related products"],
              relatedParams: ["limits", "products", "shopper"]
            },
            limits: {
              description: "Maximum number of products per recommendation profile",
              type: "array",
              example: "[5, 10, 3] (corresponds to tags array order)",
              bestPractices: [
                "Match array length to tags array",
                "Consider page layout constraints",
                "Balance variety vs. performance",
                "Typical limits: 4-12 products"
              ],
              useCases: ["Controlling recommendation quantity", "Layout optimization"],
              relatedParams: ["tags"]
            },
            shopper: {
              description: "Logged-in user identifier for personalization",
              type: "string",
              example: "user-12345",
              bestPractices: [
                "Use only for authenticated users",
                "Consistent with your user system",
                "Improves recommendation quality",
                "Don't use for anonymous users"
              ],
              useCases: ["Personalized recommendations", "User-specific suggestions"],
              relatedParams: ["cart", "lastViewed"]
            }
          },
          beacon: {
            type: {
              description: "Event type identifier for analytics tracking",
              type: "string",
              example: "profile.impression, profile.click, custom.event",
              bestPractices: [
                "Use descriptive event names",
                "Follow consistent naming conventions",
                "Group related events with prefixes",
                "Document custom event types"
              ],
              useCases: ["Event categorization", "Analytics filtering", "Reporting"],
              relatedParams: ["category", "data"]
            },
            category: {
              description: "Event category for grouping analytics events",
              type: "string",
              example: "searchspring.recommendations.user-interactions",
              bestPractices: [
                "Use Searchspring standard categories when possible",
                "Create logical category hierarchies",
                "Document custom categories",
                "Keep category names consistent"
              ],
              useCases: ["Analytics grouping", "Event filtering", "Reporting dashboards"],
              relatedParams: ["type", "data"]
            },
            data: {
              description: "Event payload containing specific event data",
              type: "object",
              example: "{profile: {tag: 'similar-products'}, product: {id: 'SKU123'}}",
              bestPractices: [
                "Include relevant event context",
                "Keep payload size reasonable",
                "Use consistent data structure",
                "Validate data before sending"
              ],
              useCases: ["Event details", "Analytics context", "Personalization data"],
              relatedParams: ["type", "context"]
            }
          }
        };
    
        const apiParams = parameterGuides[api];
        if (!apiParams) {
          return {
            content: [
              {
                type: "text",
                text: `Parameter guidance for ${api} API is not yet available. Use the searchspring_api_guide tool to get comprehensive API documentation.`,
              },
            ],
          };
        }
    
        const paramGuide = apiParams[parameter];
        if (!paramGuide) {
          const availableParams = Object.keys(apiParams);
          return {
            content: [
              {
                type: "text",
                text: `Parameter '${parameter}' not found for ${api} API.
    
    Available parameters for ${api}:
    ${availableParams.map(p => `- ${p}`).join('\n')}
    
    Use one of these parameter names to get detailed guidance.`,
              },
            ],
          };
        }
    
        return {
          content: [
            {
              type: "text",
              text: `# ${parameter} Parameter Guide (${api.toUpperCase()} API)
    
    ## Description
    ${paramGuide.description}
    
    **Type**: ${paramGuide.type}
    
    ## Example Usage
    \`\`\`
    ${paramGuide.example}
    \`\`\`
    
    ## Best Practices
    ${paramGuide.bestPractices.map((practice: string) => `- ${practice}`).join('\n')}
    
    ## Common Use Cases
    ${paramGuide.useCases.map((useCase: string) => `- ${useCase}`).join('\n')}
    
    ## Related Parameters
    ${paramGuide.relatedParams.map((param: string) => `- \`${param}\``).join('\n')}
    
    ## Documentation
    šŸ“– **API Documentation**: https://docs.searchspring.com/api/${api}/
    šŸŽÆ **Parameter Reference**: https://docs.searchspring.com/api/${api}/#parameters`,
            },
          ],
        };
      }
  • src/index.ts:51-69 (registration)
    Tool registration in the tools array, defining name, description, and input schema for the MCP server.
    {
      name: "searchspring_parameter_guide",
      description: "Get detailed explanation for specific API parameters, their usage, and best practices",
      inputSchema: {
        type: "object",
        properties: {
          api: {
            type: "string",
            enum: ["search", "autocomplete", "suggest", "trending", "recommendations", "finder", "beacon", "bulk-index"],
            description: "The Searchspring API containing the parameter",
          },
          parameter: {
            type: "string",
            description: "The specific parameter to get guidance for (e.g., 'filters', 'sort', 'tags')",
          },
        },
        required: ["api", "parameter"],
      },
    },
  • Input schema definition for the tool, specifying required api and parameter fields with enums for APIs.
    inputSchema: {
      type: "object",
      properties: {
        api: {
          type: "string",
          enum: ["search", "autocomplete", "suggest", "trending", "recommendations", "finder", "beacon", "bulk-index"],
          description: "The Searchspring API containing the parameter",
        },
        parameter: {
          type: "string",
          description: "The specific parameter to get guidance for (e.g., 'filters', 'sort', 'tags')",
        },
      },
      required: ["api", "parameter"],
    },
  • Supporting data structure containing comprehensive parameter documentation, examples, best practices, and related info used by the handler to generate responses.
    const parameterGuides: Record<string, Record<string, any>> = {
      search: {
        q: {
          description: "Search query string - the terms users want to search for",
          type: "string",
          example: "running shoes",
          bestPractices: [
            "URL encode special characters",
            "Trim whitespace before sending",
            "Consider query preprocessing (stemming, synonyms)",
            "Handle empty queries gracefully"
          ],
          useCases: ["Product search", "Site search", "Autocomplete"],
          relatedParams: ["redirectResponse", "landingPage"]
        },
        filters: {
          description: "Apply filters to search results using filter.{field}=value format",
          type: "object",
          example: "filter.brand=Nike&filter.color=blue&filter.price=50-100",
          bestPractices: [
            "Use exact field names from your product data",
            "For multiple values: filter.brand=Nike&filter.brand=Adidas",
            "For ranges: filter.price=min-max",
            "URL encode filter values"
          ],
          useCases: ["Category filtering", "Faceted navigation", "Price filtering"],
          relatedParams: ["bgfilters", "includedFacets", "excludedFacets"]
        },
        bgfilters: {
          description: "Background filters applied permanently, not visible to users",
          type: "object",
          example: "bgfilter.status=active&bgfilter.visibility=public",
          bestPractices: [
            "Use for system-level filtering (active products, visible items)",
            "Hide discontinued or out-of-stock products",
            "Apply site-specific rules",
            "Don't expose in filter UI"
          ],
          useCases: ["Product visibility", "Inventory filtering", "Site restrictions"],
          relatedParams: ["filters"]
        },
        sort: {
          description: "Sort search results by field and direction",
          type: "object",
          example: "sort.price=asc&sort.popularity=desc",
          bestPractices: [
            "Primary sort first, secondary sort second",
            "Use 'asc' for ascending, 'desc' for descending",
            "Common sorts: price, popularity, title, date",
            "Provide sort options to users"
          ],
          useCases: ["Price sorting", "Popularity sorting", "Name sorting", "Date sorting"],
          relatedParams: ["resultsPerPage", "page"]
        },
        userId: {
          description: "Unique identifier for tracking user behavior - sourced from ssUserId cookie",
          type: "string",
          example: "value from ssUserId cookie",
          bestPractices: [
            "Always get value from ssUserId cookie",
            "Automatically set by Searchspring tracking",
            "Do not manually generate - use cookie value",
            "Required for analytics and personalization"
          ],
          useCases: ["User tracking", "Personalization", "Analytics"],
          relatedParams: ["sessionId", "pageLoadId", "domain"]
        },
        sessionId: {
          description: "Session identifier for tracking user journey - sourced from ssSessionIdNamespace cookie",
          type: "string",
          example: "value from ssSessionIdNamespace cookie",
          bestPractices: [
            "Always get value from ssSessionIdNamespace cookie",
            "Automatically set by Searchspring tracking",
            "Do not manually generate - use cookie value",
            "Used for analytics and behavior tracking"
          ],
          useCases: ["Session tracking", "User journey analysis", "Analytics"],
          relatedParams: ["userId", "pageLoadId"]
        },
        pageLoadId: {
          description: "Unique identifier for each page load/search - should be UUID v4",
          type: "string",
          example: "e560933a-b0fe-408d-8df5-807270e79fb8",
          bestPractices: [
            "Generate new UUID v4 for each page load",
            "Update on every physical page load",
            "For SPA/headless: update on URL route change",
            "Critical for proper analytics tracking"
          ],
          useCases: ["Search tracking", "Click analytics", "Performance monitoring"],
          relatedParams: ["userId", "sessionId", "domain"]
        },
        domain: {
          description: "Current page URL - should be window.location.href",
          type: "string",
          example: "https://yoursite.com/search?q=shoes",
          bestPractices: [
            "Always use window.location.href value",
            "Include full URL with protocol and parameters",
            "Required for proper analytics and personalization",
            "Do not hardcode - get dynamically"
          ],
          useCases: ["Page tracking", "Analytics", "Personalization context"],
          relatedParams: ["userId", "sessionId", "pageLoadId"]
        }
      },
      autocomplete: {
        q: {
          description: "Partial search query for autocomplete suggestions",
          type: "string",
          example: "runn (user typing 'running')",
          bestPractices: [
            "Start suggestions after 2+ characters",
            "Use debouncing (50ms delay recommended by Searchspring)",
            "Handle special characters properly",
            "Clear suggestions when query is empty"
          ],
          useCases: ["Search input autocomplete", "Product suggestions", "Query completion"],
          relatedParams: ["resultsPerPage"]
        }
      },
      recommendations: {
        tags: {
          description: "Recommendation profile tags/IDs that define recommendation types",
          type: "array",
          example: "['similar-products', 'trending', 'recently-viewed']",
          bestPractices: [
            "Use meaningful profile names",
            "Configure profiles in Searchspring dashboard first",
            "Combine multiple recommendation types",
            "Order by priority/importance"
          ],
          useCases: ["Product recommendations", "Cross-selling", "Upselling", "Related products"],
          relatedParams: ["limits", "products", "shopper"]
        },
        limits: {
          description: "Maximum number of products per recommendation profile",
          type: "array",
          example: "[5, 10, 3] (corresponds to tags array order)",
          bestPractices: [
            "Match array length to tags array",
            "Consider page layout constraints",
            "Balance variety vs. performance",
            "Typical limits: 4-12 products"
          ],
          useCases: ["Controlling recommendation quantity", "Layout optimization"],
          relatedParams: ["tags"]
        },
        shopper: {
          description: "Logged-in user identifier for personalization",
          type: "string",
          example: "user-12345",
          bestPractices: [
            "Use only for authenticated users",
            "Consistent with your user system",
            "Improves recommendation quality",
            "Don't use for anonymous users"
          ],
          useCases: ["Personalized recommendations", "User-specific suggestions"],
          relatedParams: ["cart", "lastViewed"]
        }
      },
      beacon: {
        type: {
          description: "Event type identifier for analytics tracking",
          type: "string",
          example: "profile.impression, profile.click, custom.event",
          bestPractices: [
            "Use descriptive event names",
            "Follow consistent naming conventions",
            "Group related events with prefixes",
            "Document custom event types"
          ],
          useCases: ["Event categorization", "Analytics filtering", "Reporting"],
          relatedParams: ["category", "data"]
        },
        category: {
          description: "Event category for grouping analytics events",
          type: "string",
          example: "searchspring.recommendations.user-interactions",
          bestPractices: [
            "Use Searchspring standard categories when possible",
            "Create logical category hierarchies",
            "Document custom categories",
            "Keep category names consistent"
          ],
          useCases: ["Analytics grouping", "Event filtering", "Reporting dashboards"],
          relatedParams: ["type", "data"]
        },
        data: {
          description: "Event payload containing specific event data",
          type: "object",
          example: "{profile: {tag: 'similar-products'}, product: {id: 'SKU123'}}",
          bestPractices: [
            "Include relevant event context",
            "Keep payload size reasonable",
            "Use consistent data structure",
            "Validate data before sending"
          ],
          useCases: ["Event details", "Analytics context", "Personalization data"],
          relatedParams: ["type", "context"]
        }
      }
    };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool provides 'detailed explanation' and 'best practices,' implying a read-only, informational function, but doesn't specify whether it requires authentication, has rate limits, or what the output format might be. For a tool with zero annotation coverage, this is a significant gap in behavioral context.

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 a single, efficient sentence that directly states the tool's purpose without any redundant or extraneous information. It is front-loaded with the core function and appropriately sized for a simple lookup tool, 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.

Completeness3/5

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

Given the tool's low complexity (2 required parameters, no nested objects) and lack of output schema, the description is adequate but incomplete. It covers the basic purpose but misses behavioral details like authentication needs or output format. With no annotations and no output schema, the description should do more to compensate, but it's minimally viable for this simple tool.

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

Parameters3/5

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

The schema description coverage is 100%, with both parameters ('api' and 'parameter') well-documented in the input schema. The description adds minimal value beyond the schema, as it doesn't elaborate on parameter interactions or provide examples beyond what's implied. Given the high schema coverage, a baseline score of 3 is appropriate, as the description doesn't significantly enhance parameter understanding.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get detailed explanation for specific API parameters, their usage, and best practices.' It specifies the verb ('Get detailed explanation') and resource ('specific API parameters'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'searchspring_api_guide' or 'searchspring_code_generator,' which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'searchspring_api_guide' or 'searchspring_code_validator,' nor does it specify prerequisites or contexts for usage. This lack of comparative or contextual information leaves the agent with minimal guidance for tool selection.

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/yangjeep/playground-searchspring-api-assist-mcp'

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