Skip to main content
Glama

Context for a prompt

ragdown_context
Read-only

Injects relevant Markdown sections into pre-turn hooks as a ready-to-use context block, filtering low-similarity matches and skipping duplicate sections per session.

Instructions

For hooks that run before a turn: the documents related to a user prompt, as a ready-to-inject block, or empty text when nothing is similar enough. Unlike ragdown_recall it filters by min_score, skips short prompts and slash commands, and never returns a section twice for the same session_id. reset: true first forgets what that session was given; call it with an empty prompt after the client compacts or clears its context. format: 'claude-code' wraps the block as the JSON a Claude Code UserPromptSubmit hook adds to the prompt.

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": "ragdown_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
resetNoForget the sections already returned for session_id before answering, because the client no longer has them
top_kNoDefault RAGDOWN_HOOK_TOP_K
formatNo'text' is the block itself. 'claude-code' is the block as a Claude Code hook's additionalContext, for an mcp_tool hook on UserPromptSubmit, which does not pass plain text on to the modeltext
promptYesThe user's prompt, verbatim
max_charsNoMost characters in the block. Default RAGDOWN_HOOK_MAX_CHARS
min_ratioNoLowest share of the best hit's similarity a hit may have and still be included; 0 keeps every hit above min_score. Default RAGDOWN_HOOK_MIN_RATIO
min_scoreNoLowest cosine similarity to include. Default RAGDOWN_HOOK_MIN_SCORE
session_idNoStable id of the conversation; sections already returned for it are skipped

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv6.10.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / max_chars / maximum
      Added value: +9007199254740991
  2. Changed2 schema fields changedv5.16.0
    • addedInput schema / properties / format
      Added value: +{
      +  "default": "text",
      +  "description": "'text' is the block itself. 'claude-code' is the block as a Claude Code hook's additionalContext, for an mcp_tool hook on UserPromptSubmit, which does not pass plain text on to the model",
      +  "enum": [
      +    "text",
      +    "claude-code"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / reset
      Added value: +{
      +  "default": false,
      +  "description": "Forget the sections already returned for session_id before answering, because the client no longer has them",
      +  "type": "boolean"
      +}
  3. Addedv4.0.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only cover readOnlyHint and openWorldHint, so the description must carry the rest, and it does: empty-text-on-no-match, filtering by min_score, suppression of short prompts and slash commands, session-scoped dedup ('never returns a section twice for the same session_id'), and what reset destroys. The claude-code format explanation adds hook-compatibility context that annotations cannot express.

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?

Front-loads the hook use case and return shape, then trails inline notes for the non-obvious parameters. It is dense but almost every clause carries information; the trailing 'reset:' and 'format:' sentences are slightly tacked-on rather than integrated, which keeps it off a 5.

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

Completeness5/5

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

With 8 parameters, no output schema, and minimal annotations, the description still covers return shape, empty-result behavior, filtering thresholds, session state, and the reset and format special cases. An agent has everything needed to call it correctly in a hook pipeline.

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

Parameters4/5

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

Schema coverage is 100%, so the schema already defines each parameter; the baseline is 3. The description still adds genuine semantics for the two params that need it: reset's ordering ('first forgets what that session was given') and format's purpose (JSON for a Claude Code UserPromptSubmit hook that does not pass plain text to the model), which the schema only partially conveys.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource ('the documents related to a user prompt') and the exact return form ('a ready-to-inject <ragdown-context> block, or empty text when nothing is similar enough'). It explicitly contrasts itself with the sibling ragdown_recall, so an agent can distinguish the two without opening a schema.

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

Usage Guidelines5/5

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

Scoped up front to 'hooks that run before a turn' and names the alternative plus the differentiator ('Unlike ragdown_recall it filters by min_score, skips short prompts and slash commands'). It also gives an explicit when-to-use rule for reset: call it with an empty prompt after the client compacts or clears its context.

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