Skip to main content
Glama
Amazon Bedrock Knowledge Base MCP Server

Amazon Bedrock Knowledge Base MCP Server

by Zlash65

QueryKnowledgeBasesWithMetadata

Query an Amazon Bedrock knowledge base to retrieve relevant passages with metadata, supporting discovery of metadata keys and values before applying precise filters.

Instructions

Query a knowledge base and include metadata in results.

Use this for metadata-driven exploration (discover what keys/values exist) before applying precise filters. Returns newline-separated JSON objects.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>",
      "knowledge_base_id": "<knowledge_base_id>"
    },
    "name": "QueryKnowledgeBasesWithMetadata"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesA natural language query to search the knowledge base with
whereNoOptional schema-driven metadata constraints. Keys are resolved via the metadata schema: prefer schema aliases, or use direct metadata keys. Values can be scalars, lists (OR within that key), or dicts for operator overrides.
filterNoOptional raw Bedrock retrieval filter (RetrievalFilter). This is a power-user escape hatch and is only accepted when BEDROCK_KB_ALLOW_RAW_FILTER=true.
rerankingNoWhether to rerank the results. Useful for improving relevance and sorting. Can be globally configured with BEDROCK_KB_RERANKING_ENABLED.
where_joinNoHow to combine schema-driven `where` constraints. Default is AND (narrow). OR is supported within friendly filters only.AND
filter_modeNoHow to combine explicit filters (`where`/raw) and implicit filtering. 'explicit_then_implicit' applies explicit filters when provided, and also enables implicit filtering when requested; it composes constraints with AND semantics.explicit_then_implicit
search_typeNoSearch strategy for retrieval. 'HYBRID' combines keyword + semantic search and is recommended for OpenSearch Serverless; 'SEMANTIC' uses embeddings only; 'DEFAULT' lets Bedrock decide.DEFAULT
data_source_idsNoThe data source IDs to filter the knowledge base by. It must be a list of valid data source IDs from the ListKnowledgeBases tool.
implicit_filterNoEnable Bedrock implicit filtering for this call (requires BEDROCK_KB_IMPLICIT_FILTER_MODEL_ARN).
content_max_charsNoIf set, truncate returned TEXT content to this many characters to reduce tool output size.
knowledge_base_idYesThe knowledge base ID to query. It must be a valid ID from the ListKnowledgeBases tool.
number_of_resultsNoThe number of results to return. Prefer smaller values for metadata-driven discovery. If omitted and implicit_filter=true, defaults to 25; otherwise defaults to 6.
metadata_schema_modeNoMetadata schema resolution mode. 'static' uses only configured schema files; 'auto' falls back to sampling retrieval metadata to infer a schema.auto
reranking_model_nameNoThe name of the reranking model to use. Options: 'COHERE', 'AMAZON'.AMAZON
metadata_schema_auto_sample_kNoNumber of retrieval results to sample for auto schema discovery.
metadata_schema_auto_sample_queryNoQuery used for auto schema discovery (only when metadata_schema_mode=auto).the

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A3.6/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the behavioral burden, and it does disclose the return format (newline-separated JSON objects) and the discovery-then-filter workflow. However, for a 16-parameter retrieval tool it says nothing about read-only semantics, cost/latency, truncation behavior, or the environment-gated escape hatches, all of which matter for confident invocation.

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?

Three short sentences with the core purpose front-loaded and no filler. The workflow hint follows the purpose statement in a sensible order. Minor formatting indentation is the only noise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be explained, and the schema fully documents parameters. But with no annotations and 16 parameters including raw-filter and implicit-filter escape hatches, the description is thin on the operational characteristics an agent would want before committing to a call.

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 all 16 parameters, including the enum-constrained filter_mode and search_type, are already well documented in the schema. The description adds no parameter-level meaning beyond that baseline, which is acceptable given the schema coverage but not additive.

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 ("Query a knowledge base") plus a distinguishing trait ("include metadata in results"), which separates it from the plain QueryKnowledgeBases sibling. It stops short of naming the sibling explicitly, but an agent can still infer the difference from the metadata emphasis.

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 usage context: use this for metadata-driven exploration to discover what keys/values exist before applying precise filters. That is a genuine when-to-use statement with an implied follow-up action. It does not name which tool to use for the "precise filters" step, so the routing guidance is incomplete rather than explicit.

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