Skip to main content
Glama

IA-QA — 152 QA & Dev Tools for AI Agents

needle_haystack_generate

Read-only

Generate a "needle in a haystack" test: embeds a target fact into a large block of filler text at a specified position. Use this to test LLM context window retrieval accuracy. Returns the full haystack, the question to ask, and metadata. No API key needed.

Input Schema

NameRequiredDescriptionDefault
needleYesThe fact to hide (e.g. "The secret code is ALPHA-42")
tokensNoTarget haystack size in tokens (default: 5000, max: 100000)
positionNoWhere to insert the needle: "start", "middle", "end", "random" (default: "middle")middle
questionYesThe question to ask the LLM (e.g. "What is the secret code?")

Output Schema

NameRequiredDescriptionDefault
needleNo
haystackNo
positionNo
questionNo
insert_blockNo
total_blocksNo
estimated_tokensNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "needle": "The code is 4242.",
      +    "position": "middle",
      +    "question": "What is the code?",
      +    "tokens": 2000
      +  }
      +]
  2. Changed1 schema field changed
    • addedOutput schema / properties
      Added value: +{
      +  "estimated_tokens": {},
      +  "haystack": {},
      +  "insert_block": {},
      +  "needle": {},
      +  "position": {},
      +  "question": {},
      +  "total_blocks": {
      +    "type": "number"
      +  }
      +}
  3. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
  4. First observed

TDQS

A3.8/5.0
Behavior3/5

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

Annotations already establish read-only, non-destructive, closed-world behavior, so the description does not need to re-litigate safety. It adds useful operational context such as returning the full haystack and requiring no API key, but it does not explain why the tool is marked non-idempotent or how randomness affects output when position is 'random'.

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 front-loaded and compact: it names the operation, summarizes the mechanism, states the use case, and notes the return shape without wasted words. The final note about no API key is brief and operationally relevant.

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?

With full schema coverage, an output schema, and rich annotations, the description provides enough context for an agent to select and invoke the tool correctly. The only meaningful gap is the lack of explanation around non-idempotent behavior or random-position variability.

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 parameter meanings, token maximum, position enum, and defaults are already fully documented in the schema. The description mentions that the needle is inserted at a specified position, but adds no syntax, constraints, or format guidance beyond the schema.

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 verb and resource: generating a needle-in-a-haystack test by embedding a target fact into filler text. It clearly conveys the mechanism and purpose, but it does not explicitly differentiate the tool from nearby siblings such as lorem_ipsum, context_window_check, or prompt_test_suite.

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?

It gives a clear intended use: testing LLM context window retrieval accuracy. That is enough to know when to reach for it, but there is no explicit guidance on when not to use it or which alternative to use for adjacent testing needs.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.