Skip to main content
Glama

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
NameRequiredDescriptionDefault
eventTypeYesType of hook event to trigger
dataYesEvent data payload

Implementation Reference

  • 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()
        }
      });
    });
  • 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']
      }
    },
  • 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);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool triggers events but doesn't explain effects (e.g., whether it executes hooks, modifies state, or requires permissions). This is inadequate for a mutation tool with zero annotation coverage.

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 with zero waste. It's front-loaded and appropriately sized for the tool's complexity, earning a high score for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

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

Given the tool's complexity (triggering events with data payloads), no annotations, and no output schema, the description is incomplete. It fails to explain what happens after triggering (e.g., hook execution, response format, or error handling), leaving significant gaps.

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 fully documents both parameters (eventType with enum values and data as an object). The description adds no additional meaning beyond what the schema provides, meeting the baseline of 3.

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 'Trigger a hook event manually' clearly states the action (trigger) and resource (hook event), with 'manually' adding specificity. However, it doesn't distinguish this tool from sibling tools like hooks_start_watching or hooks_stop_watching, which prevents a score of 5.

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 like hooks_start_watching or hooks_stop_watching. It lacks context about prerequisites, timing, or exclusions, leaving usage unclear beyond the basic action.

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

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