Skip to main content
Glama
index.ts2.64 kB
/** * Hooks Tool Handlers */ import { HooksService } from '../../services/HooksService.js'; import { MCPTool } from '../../types/index.js'; export function registerHooksTools( tools: Map<string, Function>, hooksService: HooksService ): MCPTool[] { // Tool definitions const hooksTools: MCPTool[] = [ { name: 'hooks_trigger', description: 'Trigger a hook event manually', inputSchema: { type: 'object', properties: { eventType: { type: 'string', enum: ['pre-work', 'post-work', 'file-change', 'session-start', 'session-end'], description: 'Type of hook event to trigger' }, data: { type: 'object', description: 'Event data payload', additionalProperties: true } }, required: ['eventType', 'data'] } }, { name: 'hooks_setup_git', description: 'Setup Git hooks for automated documentation and validation', inputSchema: { type: 'object', properties: {}, required: [] } }, { name: 'hooks_start_watching', description: 'Start file system watching for automatic event triggering', inputSchema: { type: 'object', properties: { patterns: { type: 'array', items: { type: 'string' }, description: 'File patterns to watch (optional, uses defaults if not provided)' } }, required: [] } }, { name: 'hooks_stop_watching', description: 'Stop file system watching', inputSchema: { type: 'object', properties: {}, required: [] } } ]; // Register tool handlers tools.set('hooks_trigger', async (args: any) => { return await hooksService.processHookRequest({ event: { type: args.eventType, data: args.data, timestamp: new Date().toISOString() } }); }); tools.set('hooks_setup_git', async () => { const gitSetup = await hooksService.setupGitHooks(); return { success: gitSetup, message: gitSetup ? 'Git hooks setup successfully' : 'Failed to setup Git hooks' }; }); tools.set('hooks_start_watching', async (args: any) => { await hooksService.startFileWatching(args.patterns); return { success: true, message: 'File watching started', patterns: args.patterns }; }); tools.set('hooks_stop_watching', async () => { await hooksService.stopFileWatching(); return { success: true, message: 'File watching stopped' }; }); return hooksTools; }

Implementation Reference

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/Ghostseller/CastPlan_mcp'

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