Skip to main content
Glama

Ask Collection

ask_collection
Read-onlyIdempotent

Answer a question using RAG over a document collection. Retrieves relevant chunks then synthesizes a cited answer with source attribution. Use when you need a direct answer grounded in your collection documents. For raw matching chunks (without synthesis), use search_collection instead. For single-document Q&A, use qa_url instead. PREREQUISITE: Collection must be populated via add_document_to_collection and indexed before results appear. Returns: { answer: string, sources: [{ bundle_id, chunk_id }], retrieval: [{ bundle_id, chunk_id, text, score }] } Example prompts:

  • "What are the key terms of the service agreement in my collection?"

  • "Based on my due diligence docs, what are the main risks?"

  • "Answer this question using all documents in the Q4 Contracts collection."

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
questionYesNatural language question to answer from collection documents. Example: "What are the key terms of the service agreement?"
max_chunksNoMax chunks to retrieve for context (default 8). Increase for broad questions, decrease for precision. Example: 12
collection_idYesCollection ID (col_...) returned by create_collection. Example: "col_550e8400-e29b-41d4-a716-446655440000"

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
answerYes
sourcesYes
retrievalYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "answer": {
      +      "additionalProperties": false,
      +      "properties": {
      +        "citations": {
      +          "items": {
      +            "additionalProperties": false,
      +            "properties": {
      +              "artifact": {
      +                "type": "string"
      +              },
      +              "char_end": {
      +                "type": "number"
      +              },
      +              "char_start": {
      +                "type": "number"
      +              },
      +              "chunk_id": {
      +                "type": "string"
      +              },
      +              "confidence": {
      +                "enum": [
      +                  "high",
      +                  "medium",
      +                  "low"
      +                ],
      +                "type": "string"
      +              },
      +              "page": {
      +                "type": "number"
      +              },
      +              "paragraphs": {
      +                "items": {
      +                  "type": "number"
      +                },
      +                "type": "array"
      +              },
      +              "quote": {
      +                "type": "string"
      +              }
      +            },
      +            "required": [
      +              "quote",
      +              "paragraphs",
      +              "confidence"
      +            ],
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        "confidence": {
      +          "enum": [
      +            "high",
      +            "medium",
      +            "low"
      +          ],
      +          "type": "string"
      +        },
      +        "value": {}
      +      },
      +      "required": [
      +        "value",
      +        "confidence",
      +        "citations"
      +      ],
      +      "type": "object"
      +    },
      +    "retrieval": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "bundle_id": {
      +            "type": "string"
      +          },
      +          "chunk_id": {
      +            "type": "string"
      +          },
      +          "score": {
      +            "type": "number"
      +          },
      +          "text": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "bundle_id",
      +          "chunk_id",
      +          "text",
      +          "score"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "sources": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "bundle_id": {
      +            "type": "string"
      +          },
      +          "chunk_id": {
      +            "type": "string"
      +          }
      +        },
      +        "required": [
      +          "bundle_id",
      +          "chunk_id"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    }
      +  },
      +  "required": [
      +    "answer",
      +    "sources",
      +    "retrieval"
      +  ],
      +  "type": "object"
      +}
  4. Changed3 schema fields changed
    • changedInput schema / properties / collection_id / description
      Previous value: -"Collection ID (col_...) returned by create_collection"New value: +"Collection ID (col_...) returned by create_collection. Example: \"col_550e8400-e29b-41d4-a716-446655440000\""
    • changedInput schema / properties / max_chunks / description
      Previous value: -"Max chunks to retrieve for context (default 8). Increase for broad questions, decrease for precision."New value: +"Max chunks to retrieve for context (default 8). Increase for broad questions, decrease for precision. Example: 12"
    • changedInput schema / properties / question / description
      Previous value: -"Natural language question to answer from collection documents"New value: +"Natural language question to answer from collection documents. Example: \"What are the key terms of the service agreement?\""
  5. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations cover the safety profile (readOnly, idempotent), and the description adds genuinely non-obvious behavior: the prerequisite that the collection must be populated and indexed before results appear, and the two-stage retrieve-then-synthesize flow. It also sketches the return shape, though that overlaps with the output schema, keeping it short of a 5.

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 purpose then routing then prerequisite, and each block earns its place. The example prompts add realistic usage color but make the definition longer than strictly necessary.

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 description covers purpose, alternatives, the indexing prerequisite, and the retrieval/synthesis behavior; the structured output schema handles return-value detail. Nothing an agent needs to call this correctly is missing.

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 question, max_chunks (with default and tuning guidance), and collection_id are already documented in the schema. The description adds no syntax or format detail beyond that, so the baseline 3 applies.

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: RAG-based question answering over a document collection, and explicitly contrasts itself with search_collection (raw chunks) and qa_url (single-document Q&A). An agent can distinguish it from all three relevant siblings 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?

Gives an explicit use condition ('need a direct answer grounded in your collection documents') plus two named alternatives with the selection criteria for each. This is the when/when-not/alternative pattern at full strength.

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.

Resources