Skip to main content
Glama
Teradata

Teradata MCP Server

Official
by Teradata

Rag Execute Workflow

rag_Execute_Workflow
Read-onlyIdempotent

Execute a complete RAG workflow: generate query embeddings, search document chunks, and return a direct answer grounded only in the retrieved context.

Instructions

Execute complete RAG workflow to answer user questions based on document context. This tool handles the entire RAG pipeline in a single step when a user query is tagged with /rag.

WORKFLOW STEPS (executed automatically):

  1. Configuration setup using configurable values from rag_config.yml

  2. Store user query with '/rag ' prefix stripping

  3. Generate query embeddings using either BYOM (ONNXEmbeddings) or IVSM functions based on config

  4. Perform semantic search against precomputed chunk embeddings

  5. Return context chunks for answer generation

CONFIGURATION VALUES (from rag_config.yml):

  • version: 'ivsm' or 'byom' to select embedding approach

  • All database names, table names, and model settings are configurable

  • Vector store metadata fields are dynamically detected

  • Embedding parameters are configurable

  • Default chunk retrieval count is configurable

  • Default values are provided as fallback

TECHNICAL DETAILS:

  • Strips the '/rag ' prefix if present from user questions

  • Creates query table if it does not exist (columns: id, txt, created_ts)

  • BYOM approach: Uses mldb.ONNXEmbeddings UDF for tokenization and embedding

  • IVSM approach: Uses ivsm.tokenizer_encode and ivsm.IVSM_score functions

  • Both approaches store embeddings in configured output table

  • Uses cosine similarity via TD_VECTORDISTANCE for semantic search

  • Returns the top-k matching chunks from the configured vector store

  • Each result includes chunk text, similarity score, and metadata fields

CRITICAL ANSWERING RULES:

  • Answer ONLY using retrieved chunks - no external knowledge, speculation, or inference

  • Quote source content directly without paraphrasing, summarizing, or rewriting

  • If no relevant context found: "Not enough information found in the provided context"

  • If partial context: "The available context does not fully answer the question"

  • Include document/page references when available (e.g., "On page 2 of 'demo_policy.pdf'...")

  • Execute entire workflow silently without showing function calls to user - only show final answer

LANGUAGE RESTRICTIONS:

  • Do not say "According to the context" or "The context says" - just quote directly

  • Do not say "It can be inferred that..." - no inference allowed

  • Use exact or near-verbatim quotes only

  • No paraphrasing, summarizing, or adding transitions between quotes

  • Copy content precisely - no expansion or interpretation

BEHAVIORAL REQUIREMENTS:

  • Execute all RAG workflow steps silently without showing tool calls to users

  • Only display final answers based strictly on retrieved context chunks

  • Do not use external knowledge or speculation - only quote retrieved content directly

  • RAG mode only triggers with explicit /rag prefix - do not enter RAG mode implicitly

  • Hide all tool execution steps from user

  • Provide clean, direct response with only the answer based on retrieved chunks

  • This is a complete end-to-end RAG workflow - no additional tools needed

EXECUTION: Run completely silently - user only sees their question and the final context-grounded answer.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kNo
questionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.2.1
    • addedInput schema / additionalProperties
      Added value: +false
    • removedInput schema / properties / k / title
      Removed value: -"K"
    • removedInput schema / properties / question / title
      Removed value: -"Question"
  2. Addedv1.0.0

TDQS

B3.4/5.0
Behavior1/5

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

On its own terms the description is remarkably transparent: it discloses prefix stripping, table creation, BYOM/IVSM embedding paths, TD_VECTORDISTANCE cosine similarity, top-k retrieval, and detailed answering and language constraints. However, it expressly discloses write behaviors - 'Creates query table if it does not exist' and 'Both approaches store embeddings in configured output table' - which directly contradict the annotation readOnlyHint=true. An agent relying on that annotation would expect zero environment modification and could be surprised (or fail) in a read-only environment where DDL is prohibited; per the contradiction rule this scores 1.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear section headers and a front-loaded overview, and the answering rules mostly earn their space. But it is bloated with repetition: silent execution is stated roughly five times, no-paraphrasing/quote-directly about four times, and no-external-knowledge about three times across CRITICAL ANSWERING RULES, LANGUAGE RESTRICTIONS, BEHAVIORAL REQUIREMENTS, and EXECUTION. Roughly a third of the text is redundant reinforcement of the same constraints.

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?

For a complex end-to-end pipeline with no output schema, coverage is strong: workflow steps, configuration sources, technical implementation details, result contents (chunk text, similarity score, metadata fields), fallback answer phrases, and document-reference format are all specified. Gaps remain around explicit return structure, error/failure behavior, and the un-annotated requirement for write privileges, but the operational contract an agent needs to answer correctly is substantially complete.

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?

With 0% schema description coverage, the description must carry the parameter burden, and it partially does: question is clearly the user query, including the '/rag ' prefix-stripping behavior, and k maps to retrieval count via 'Returns the top-k matching chunks' with 'Default chunk retrieval count is configurable' as fallback. But neither parameter is ever explicitly mapped by name, and k's exact contract (overriding the configured default, null behavior) is left to inference.

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?

Opens with a specific verb-object pair ('Execute complete RAG workflow') plus a purpose ('answer user questions based on document context'), and immediately clarifies the scope: a single-step pipeline triggered by a /rag-tagged query. This differentiates it from sibling sql_Execute_Full_Pipeline, which handles the SQL pipeline instead. The tool's function is unmistakable even before reading the workflow details.

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?

Gives an explicit trigger condition ('when a user query is tagged with /rag') and an explicit exclusion ('RAG mode only triggers with explicit /rag prefix - do not enter RAG mode implicitly'), plus 'no additional tools needed' to discourage tool chaining. However, it never names sibling alternatives for non-RAG query types (e.g., base_readQuery or sql_Execute_Full_Pipeline), so routing is implied by the /rag condition rather than explicitly contrasted with alternatives.

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