Skip to main content
Glama

hallucination_check

Read-onlyIdempotent

Lexical hallucination check: verifies an LLM answer's words, numbers and polarity against the provided source/context. Fast, deterministic, no API key needed. Each answer sentence is aligned to its best-matching source sentence, so a number only counts as support when it sits on the SAME statement ("founded in 1998" is not grounded by "sold 1998 units"), and a negation or antonym flip against that sentence returns verdict "contradicted" — the corrupted-fact hallucination that reuses source vocabulary. Limitations: still lexical — it cannot follow a paraphrase, a synonym, or multi-sentence reasoning, so a "well_grounded" verdict means "nothing lexical found", never "verified true". Entailment: run_semantic_tests (NLI/embedding) or a calibrated judge.

Example tool call

This call uses example arguments supplied in the tool’s input schema.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "answer": "Le remboursement prend plus de 7 jours ouvrés.",
      "context": "Le remboursement prend plus de 7 jours ouvrés."
    },
    "name": "hallucination_check"
  }
}

Input Schema

NameRequiredDescriptionDefault
casesNoBatch instead of answer + context: one result per case, and the worst gate overall.
answerNoThe LLM answer to verify (with context).
strictNoEvery sentence must be supported (default false).
contextNoThe source text that should ground it.

Output Schema

NameRequiredDescriptionDefault
detailNo
messageNo
numbersNo
overlapNo
verdictNo
analysisNo
entitiesNo
groundedNo
sentenceNo
total_wordsNo
matched_wordsNo
contradictionsNo
grounded_countNo
unbound_claimsNo
grounding_scoreNo
total_sentencesNo
ungrounded_countNo
unsupported_claimsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "answer": "Le remboursement prend plus de 7 jours ouvrés.",
      +    "context": "Le remboursement prend plus de 7 jours ouvrés."
      +  }
      +]
    • changedInput schema / properties / answer / description
      Previous value: -"The LLM-generated answer to verify"New value: +"The LLM answer to verify (with context)."
    • addedInput schema / properties / cases
      Added value: +{
      +  "description": "Batch instead of answer + context: one result per case, and the worst gate overall.",
      +  "items": {
      +    "properties": {
      +      "answer": {
      +        "type": "string"
      +      },
      +      "context": {
      +        "type": "string"
      +      },
      +      "id": {
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "answer",
      +      "context"
      +    ],
      +    "type": "object"
      +  },
      +  "maxItems": 50,
      +  "type": "array"
      +}
    • changedInput schema / properties / context / description
      Previous value: -"The source/reference text that should ground the answer"New value: +"The source text that should ground it."
    • changedInput schema / properties / strict / description
      Previous value: -"If true, every sentence in the answer must be supported (default: false)"New value: +"Every sentence must be supported (default false)."
    • removedInput schema / required
      Removed value: -[
      -  "answer",
      -  "context"
      -]
  2. First observed

TDQS

A4.4/5.0
Behavior5/5

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

Beyond the read-only annotations, the description explains sentence alignment, same-statement number support, contradiction detection via negation or antonym flip, the meaning of a 'well_grounded' verdict, and lexical limitations around paraphrase and multi-sentence reasoning. This is rich behavioral context that an agent cannot get from the annotations alone.

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?

The description is dense but front-loaded, with purpose and scope first and limitations second. Most sentences carry substantive meaning, though it is longer than strictly necessary for a single tool.

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?

Given the tool's complexity, the presence of an output schema, and the fully described input schema, the description is complete enough to call correctly. It sets expectations about what a positive verdict does and does not mean, which is essential for this tool.

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 already documents `answer`, `context`, `cases`, and `strict`. The description adds useful conceptual detail about sentence alignment but does not add parameter-specific meaning beyond what the schema provides.

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?

The description states a specific verb and resource: a lexical hallucination check that verifies an answer's words, numbers and polarity against provided source context. It clearly distinguishes itself from semantic entailment by naming `run_semantic_tests` as the alternative.

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 clear usage context: fast, deterministic, no API key, and explicitly recommends `run_semantic_tests` for entailment or paraphrased reasoning. It lacks an explicit 'use this when' rule, but the limitations and alternative make the intended scope easy to infer.

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.