Skip to main content
Glama
taurgis

SFCC Development MCP Server

by taurgis

get_hook_reference

Retrieve hook reference tables for SFCC API extension points. View available OCAPI or SCAPI hook endpoints, signatures, and usage details to implement correct hooks when extending Salesforce Commerce Cloud APIs.

Instructions

Get comprehensive hook reference tables showing all available OCAPI or SCAPI hook endpoints and extension points. Use this when implementing hooks to see all available extension points, understand hook signatures, and ensure you're using the correct hook for your use case. Essential reference when extending SFCC APIs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
guideNameYesThe hook guide name

Implementation Reference

  • The core handler function that implements the get_hook_reference tool logic by parsing markdown tables from best practices guides to extract OCAPI/SCAPI hook references.
    async getHookReference(guideName: string): Promise<Array<{
      category: string;
      hooks: Array<{endpoint: string; hookPoints: string[]; signature?: string}>;
    }>> {
      if (!guideName.includes('hooks')) {return [];}
    
      const cacheKey = `best-practices:hook-reference:${guideName}`;
      const cached = this.cache.getSearchResults(cacheKey);
      if (cached) {return cached;}
    
      const guide = await this.getBestPracticeGuide(guideName);
      if (!guide) {return [];}
    
      const reference = [];
      const lines = guide.content.split('\n');
      let currentCategory = '';
      let inTable = false;
      let hooks: Array<{endpoint: string; hookPoints: string[]; signature?: string}> = [];
    
      for (const line of lines) {
        // Look for hook reference sections
        if (line.match(/^###?\s+(Shop API Hooks|Data API Hooks|Shopper.*Hooks|.*API Hooks)/i)) {
          if (currentCategory && hooks.length > 0) {
            reference.push({ category: currentCategory, hooks: [...hooks] });
          }
          currentCategory = line.replace(/^#+\s*/, '');
          hooks = [];
          inTable = false;
        }
    
        // Detect table headers
        if (line.includes('API Endpoint') && line.includes('Hook')) {
          inTable = true;
          continue;
        }
    
        // Skip separator line
        if (line.match(/^\|[\s\-|]+\|$/)) {
          continue;
        }
    
        // Parse table rows
        if (inTable && line.startsWith('|') && !line.includes('**')) {
          const parts = line.split('|').map(p => p.trim()).filter(p => p);
          if (parts.length >= 2) {
            const endpoint = parts[0].replace(/`/g, '');
            const hookPoints = parts[1].split(',').map(h => h.replace(/`/g, '').trim());
            const signature = parts[2] ? parts[2].replace(/`/g, '') : undefined;
    
            if (endpoint && hookPoints.length > 0) {
              hooks.push({ endpoint, hookPoints, signature });
            }
          }
        }
    
        // End table when we hit a new section
        if (inTable && line.startsWith('#')) {
          inTable = false;
        }
      }
    
      // Add last category
      if (currentCategory && hooks.length > 0) {
        reference.push({ category: currentCategory, hooks });
      }
    
      this.cache.setSearchResults(cacheKey, reference);
      return reference;
    }
  • The input schema definition, description, and tool specification for get_hook_reference.
    {
      name: 'get_hook_reference',
      description: "Get comprehensive hook reference tables showing all available OCAPI or SCAPI hook endpoints and extension points. Use this when implementing hooks to see all available extension points, understand hook signatures, and ensure you're using the correct hook for your use case. Essential reference when extending SFCC APIs.",
      inputSchema: {
        type: 'object',
        properties: {
          guideName: {
            type: 'string',
            description: 'The hook guide name',
            enum: ['ocapi_hooks', 'scapi_hooks'],
          },
        },
        required: ['guideName'],
      },
    },
  • The tool registration configuration that wires the handler, validation, and execution logic for get_hook_reference, delegating to SFCCBestPracticesClient.getHookReference.
      get_hook_reference: {
        defaults: (args: ToolArguments) => args,
        validate: (args: ToolArguments, toolName: string) => {
          ValidationHelpers.validateArguments(args, CommonValidations.requiredString('guideName'), toolName);
        },
        exec: async (args: ToolArguments, context: ToolExecutionContext) => {
          const client = context.bestPracticesClient as SFCCBestPracticesClient;
          return client.getHookReference(args.guideName as string);
        },
        logMessage: (args: ToolArguments) => `Hook reference ${args.guideName}`,
      },
    };
Behavior4/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 effectively communicates that this is a read-only reference tool ('Get comprehensive hook reference tables'), though it doesn't mention specific behavioral aspects like response format, pagination, or error conditions. The description is accurate but could provide more operational details.

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 efficiently structured with three sentences that each serve distinct purposes: stating the tool's function, providing usage guidance, and emphasizing its importance. There's no wasted verbiage, and the most critical information appears first.

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 tool's single parameter with full schema coverage and no output schema, the description provides good contextual completeness by explaining when and why to use this tool. However, it could be more complete by mentioning what the output looks like (tables of hook endpoints) or any limitations.

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?

Schema description coverage is 100%, so the schema already fully documents the single parameter. The description doesn't add any parameter-specific information beyond what's in the schema, maintaining the baseline score of 3 for high schema coverage.

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's purpose with specific verbs ('Get comprehensive hook reference tables') and resources ('OCAPI or SCAPI hook endpoints and extension points'). It distinguishes this tool from sibling tools by focusing specifically on hook references rather than general documentation or search capabilities.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: 'Use this when implementing hooks to see all available extension points, understand hook signatures, and ensure you're using the correct hook for your use case.' It also positions it as 'Essential reference when extending SFCC APIs,' creating clear context for its application.

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/taurgis/sfcc-dev-mcp'

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