Skip to main content
Glama

hook

Routes Claude Code lifecycle events (session-start, post-compact, post-commit, checkpoint) with client-read git facts to Worktrail and returns the script's JSON output.

Instructions

For the Claude Code hook script only (thin client) — not for agents. event = session-start | post-compact | post-commit | checkpoint; facts = git facts of the worktree read on the client (threads.local_facts). Returns the hook's JSON output.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "event": "<event>",
      "facts": "<facts>"
    },
    "name": "hook"
  }
}

Input Schema

NameRequiredDescriptionDefault
whyNo
eventYes
factsYes
reasonNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the burden, and it does disclose the client-side origin of facts (git facts of the worktree read on the client, threads.local_facts) and that it returns the hook's JSON output. It does not say what side effects firing an event has, what authentication/context is required, or whether the call is idempotent or mutating.

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?

A single dense sentence pair with the audience restriction front-loaded, then event values, then fact provenance, then return type. No filler wording; every clause carries information.

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

Completeness3/5

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

For a thin-client tool with no output schema and no annotations, an agent still lacks the meaning of `why`/`reason`, the expected keys inside `facts`, and what side effects each event triggers. What is present is accurate and useful, but the definition stops short of being self-sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% for four parameters, so the description must compensate; it only glosses `event` (by listing values) and `facts` (git facts of the worktree, sourced from threads.local_facts). `why` and `reason` go entirely unexplained in both schema and description, and `facts`' nested additionalProperties shape is left undefined.

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?

States a specific resource (hook JSON output for the Claude Code hook script) and enumerates the valid event values, which an agent could not infer from the schema (event has no enum). It also explicitly excludes agents as callers, distinguishing it from siblings like note_turn or declare.

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

Usage Guidelines4/5

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

Explicitly says "thin client only — not for agents," which is a strong exclusion telling the agent not to select this tool. It gives no positive routing to a sibling for the same events, but for a tool an agent should avoid, the exclusion is the guidance that matters.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.