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}`, }, };

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