hooks_trigger
Manually trigger hook events like pre-work, post-work, or file-change to integrate with CastPlan MCP's project memory system.
Instructions
Trigger a hook event manually
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| eventType | Yes | Type of hook event to trigger | |
| data | Yes | Event data payload |
Implementation Reference
- src/tools/hooks/index.ts:70-78 (handler)The handler function for the 'hooks_trigger' tool. It constructs a hook event from the input arguments and delegates processing to the HooksService.tools.set('hooks_trigger', async (args: any) => { return await hooksService.processHookRequest({ event: { type: args.eventType, data: args.data, timestamp: new Date().toISOString() } }); });
- src/tools/hooks/index.ts:14-33 (schema)Input schema definition for the 'hooks_trigger' tool, specifying required eventType (enum) and data object.{ 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'] } },
- src/tools/hooks/index.ts:8-96 (registration)The registerHooksTools function defines and registers the hooks_trigger tool (schema and handler) along with other hooks tools.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; }
- src/index.ts:415-417 (registration)Top-level registration call in the main server class, which invokes registerHooksTools to add the hooks_trigger tool to the global tools map and definitions.if (this.config.services.hooks && this.hooksService) { const hookTools = registerHooksTools(this.tools, this.hooksService); this.toolDefinitions.push(...hookTools);