Skip to main content
Glama

knowledge_query

Read-onlyIdempotent

Answer questions using knowledge base (uploaded documents, handbooks, files).

Use for QUESTIONS that need an answer synthesized from documents or messages. Returns an evidence pack with source citations, KG entities, and extracted numbers.

Modes:

  • 'auto' (default): Smart routing — works for most questions

  • 'rag': Semantic search across documents & messages

  • 'entity': Entity-centric queries (e.g., 'Tell me about [entity]')

  • 'relationship': Two-entity queries (e.g., 'How is [entity A] related to [entity B]?')

Examples:

  • 'What did we discuss about the budget?' → knowledge.query

  • 'Tell me about [entity]' → knowledge.query mode=entity

  • 'How is [A] related to [B]?' → knowledge.query mode=relationship

NOT for finding/listing files, threads, or links — use search.files / search.threads / search.links for that.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
date_toNoFilter messages until this date (ISO format: YYYY-MM-DD).
file_idsNoSpecific file IDs to search within (for pinned files). Only ids returned by files.search or listed in the [ATTACHMENTS] block of THIS run; an id you have not seen in this workspace matches nothing and the search comes back empty. Leave it out to search the agent's collections. Numeric ids; numeric strings are accepted.
questionYesThe question to answer from user's knowledge base. Required even for entity queries.
date_fromNoFilter messages from this date (ISO format: YYYY-MM-DD). Use for time-based queries like 'this week', 'last month'.
thread_idNoLimit search to a specific thread/chat
max_sourcesNoMaximum number of sources to consider (1-10)
in_workspaceNoRun this one call in this workspace id instead of the session's. Nothing is stored; other sessions are not affected.
needs_aggregationNoTrue if query asks for totals/sums/counts.
include_relationshipsNoInclude KG relationships in answer (default: true for entity mode)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / in_workspace
      Added value: +{
      +  "description": "Run this one call in this workspace id instead of the session's. Nothing is stored; other sessions are not affected.",
      +  "type": "integer"
      +}
  2. Added
  3. Removed
  4. Changed7 schema fields changed
    • removedInput schema / properties / entity_name
      Removed value: -{
      -  "description": "Entity name for entity/graph modes (optional for auto mode)",
      -  "type": "string"
      -}
    • removedInput schema / properties / entity_names
      Removed value: -{
      -  "description": "Both entity names for relationship queries.",
      -  "items": {
      -    "type": "string"
      -  },
      -  "type": "array"
      -}
    • removedInput schema / properties / mode
      Removed value: -{
      -  "default": "auto",
      -  "description": "Query mode:\n- 'auto' (default): Smart routing based on question\n- 'rag': Pure semantic search with KG boost\n- 'entity': GraphRAG for entity queries\n- 'relationship': Two-entity relationship query\n- 'graph': Direct KG traversal only",
      -  "enum": [
      -    "auto",
      -    "rag",
      -    "entity",
      -    "relationship",
      -    "graph"
      -  ],
      -  "type": "string"
      -}
    • removedInput schema / properties / person_names
      Removed value: -{
      -  "description": "Person names mentioned in the query. Used for keyword fallback when RAG misses.",
      -  "items": {
      -    "type": "string"
      -  },
      -  "type": "array"
      -}
    • removedInput schema / properties / query_type
      Removed value: -{
      -  "description": "Query classification hint. Skips internal AI analysis when provided.",
      -  "enum": [
      -    "general",
      -    "numerical",
      -    "entity",
      -    "relationship"
      -  ],
      -  "type": "string"
      -}
    • removedInput schema / properties / search_keywords
      Removed value: -{
      -  "description": "Key search terms to enhance RAG matching.",
      -  "items": {
      -    "type": "string"
      -  },
      -  "type": "array"
      -}
    • removedInput schema / properties / style
      Removed value: -{
      -  "default": "concise",
      -  "description": "Answer style: concise, detailed, or bullet",
      -  "enum": [
      -    "concise",
      -    "detailed",
      -    "bullet"
      -  ],
      -  "type": "string"
      -}
  5. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false, and openWorldHint=false, so safety is covered. The description adds behavioral value by disclosing the return shape ('evidence pack with source citations, KG entities, and extracted numbers') and the four routing modes, though it omits limits such as result caps or latency.

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-loaded with the core purpose, then modes, then examples, then the exclusion — a logical order. The three example lines are somewhat redundant with the mode list, but each earns modest value and nothing is buried.

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 no output schema, the description carries the return-value burden and does so ('evidence pack with source citations, KG entities, and extracted numbers'). Combined with the mode explanations, usage rules, and explicit sibling routing, an agent has everything needed to call it correctly.

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 documents all nine parameters and the baseline is 3. The description adds meaning beyond the schema by defining the routing modes (auto/rag/entity/relationship) that aren't exposed as schema properties, which is useful context for invocation.

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 ('Answer questions using knowledge base') and immediately scopes it (uploaded documents, handbooks, files). It explicitly distinguishes itself from siblings by naming search.files/search.threads/search.links as the tools for finding/listing, so an agent can select this without opening either 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?

Explicit when-to-use ('QUESTIONS that need an answer synthesized from documents or messages') plus an explicit when-not ('NOT for finding/listing files, threads, or links') with the exact alternatives. It even maps example queries to the right mode.

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.