Skip to main content
Glama

prompt_hook

Read-onlyIdempotent

Receives Claude Code UserPromptSubmit prompts and returns a code map as hook JSON, enabling request-aware context without direct tool calls.

Instructions

Hook only, do not call: Claude Code's UserPromptSubmit hook (mcp_tool) sends the prompt and gets the code map of the request as hook JSON.

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": {
      "prompt": "<prompt>"
    },
    "name": "prompt_hook"
  }
}

Input Schema

NameRequiredDescriptionDefault
promptYesThe prompt.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.12.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive, closed-world), so the description's job is to add the surrounding context, and it does: this is invoked externally by Claude Code's hook system and returns hook-shaped JSON rather than a normal tool result. What is missing is any indication of the shape or size of that JSON, so the agent cannot reason about output beyond 'hook JSON'.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One sentence, front-loaded with the critical 'Hook only, do not call' warning before any explanatory detail. The trailing clause 'code map of the request as hook JSON' is slightly compressed and ambiguous, but nothing is redundant.

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

Completeness4/5

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

For a one-parameter tool that agents are told not to call, the definition covers caller, purpose, and return channel. With no output schema, the description does mention the return format, though only loosely ('hook JSON', 'code map'). An agent has enough to know to avoid this tool, which is the primary need.

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?

There is a single required parameter with 100% schema description coverage, so the schema already documents it. The description only restates that the prompt is what gets sent, adding no format, size, or content constraints. Baseline 3 is appropriate when the schema carries the parameter documentation.

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 states a specific mechanism: it is Claude Code's UserPromptSubmit hook that submits the prompt and returns a code map as hook JSON. The added warning 'Hook only, do not call' immediately distinguishes it from the search/query siblings an agent would normally pick. The phrase 'code map of the request' is somewhat vague about the actual payload, which keeps it from a 5.

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?

There is an explicit and unusually strong usage exclusion: 'Hook only, do not call.' That tells the agent precisely when not to use it, which is the main routing decision here. It does not name a sibling alternative to use instead, so it stops short of a 5.

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