MCP Tool Reference

All 59 tools available via the PolyDB MCP endpoint. Connect with any MCP-compatible AI agent (Claude, GPT-4, Gemini) to access 15 currently-available data models (Transaction coming soon) through a single interface.

Analytics 3 tools

create_analytics_cube

Create a named OLAP cube backed by a fact table with specified dimensions and measures. The cube is persisted and can be queried repeatedly with different aggregations.

ParameterTypeRequiredDescription
cube_namestrrequiredUnique name for the cube
fact_tablestrrequiredName of the underlying fact table
dimensionsList[str]requiredColumn names to use as dimensions (e.g. ["region", "product"])
measuresList[str]requiredColumn names to aggregate (e.g. ["revenue", "units_sold"])
Returns
{"success": true, "cube_name": "sales_cube", "fact_table": "sales", "dimensions": ["region", "product"], "measures": ["revenue"]}
Usage
create_analytics_cube(
  cube_name="sales_cube",
  fact_table="sales",
  dimensions=["region", "product", "quarter"],
  measures=["revenue", "units_sold"]
)

query_analytics

Query an OLAP cube with optional dimension grouping, measure selection, and filter predicates. Returns aggregated results with execution metadata.

ParameterTypeRequiredDescription
cube_namestrrequiredName of the cube to query
dimensionsList[str]optionalDimensions to group by; defaults to all
measuresList[str]optionalMeasures to aggregate; defaults to all
filtersDictoptionalKey-value filter predicates, e.g. {"region": "EMEA"}
Returns
{"results": [{"region": "EMEA", "revenue": 4200000}], "count": 1, "execution_time": 0.043, "cache_hit": false}
Usage
query_analytics(
  cube_name="sales_cube",
  dimensions=["region"],
  measures=["revenue"],
  filters={"quarter": "Q4"}
)

delete_analytics_cube

Permanently delete a named OLAP cube and all associated metadata.

ParameterTypeRequiredDescription
cube_namestrrequiredName of the cube to delete
Returns
{"deleted": true, "cube_name": "sales_cube"}
Usage
delete_analytics_cube(cube_name="sales_cube")

Blob 3 tools

store_blob

Store arbitrary binary content (base64-encoded) with optional filename, MIME type, and metadata. Returns a unique blob ID for later retrieval.

ParameterTypeRequiredDescription
contentstrrequiredBase64-encoded binary content
filenamestroptionalOriginal filename hint
mime_typestroptionalMIME type, e.g. "image/png"
metadataDictoptionalArbitrary key-value metadata to attach
Returns
{"blob_id": "blob_a1b2c3d4", "filename": "report.pdf", "mime_type": "application/pdf", "size": 204800}
Usage
store_blob(
  content="JVBERi0xLjQK...",   # base64
  filename="report.pdf",
  mime_type="application/pdf",
  metadata={"owner": "alice", "project": "Q4"}
)

get_blob

Retrieve a stored blob by its ID. Returns the base64-encoded content, associated metadata, byte size, and content hash for integrity verification.

ParameterTypeRequiredDescription
blob_idstrrequiredBlob ID returned by store_blob
Returns
{"content": "JVBERi0xLjQK...", "metadata": {"owner": "alice"}, "size": 204800, "content_hash": "sha256:abc..."}
Usage
get_blob(blob_id="blob_a1b2c3d4")

delete_blob

Permanently delete a blob by its ID.

ParameterTypeRequiredDescription
blob_idstrrequiredBlob ID to delete
Returns
{"deleted": true, "blob_id": "blob_a1b2c3d4"}
Usage
delete_blob(blob_id="blob_a1b2c3d4")

Document 4 tools

store_document

Store a JSON document in a named collection. If no document_id is provided, one is auto-generated. Documents are stored with full JSON fidelity and are queryable via filter expressions.

ParameterTypeRequiredDescription
collectionstrrequiredCollection name (created automatically if absent)
documentDictrequiredJSON document to store
document_idstroptionalCustom document ID; auto-generated if omitted
Returns
{"document_id": "doc_x7y8z9"}
Usage
store_document(
  collection="users",
  document={"name": "Alice", "role": "admin", "active": true},
  document_id="user_alice"
)

search_documents

Query documents in a collection using a filter expression. Supports equality, range, and nested field filters. Returns matching documents up to the specified limit.

ParameterTypeRequiredDescription
collectionstrrequiredCollection to search
filterDictoptionalFilter predicates, e.g. {"role": "admin"}
limitintoptional (default 10)Maximum number of documents to return
Returns
{"documents": [{"_id": "user_alice", "name": "Alice", "role": "admin"}], "count": 1}
Usage
search_documents(
  collection="users",
  filter={"role": "admin", "active": true},
  limit=50
)

get_document

Retrieve a single document by its exact ID from a collection.

ParameterTypeRequiredDescription
collectionstrrequiredCollection containing the document
document_idstrrequiredDocument ID to retrieve
Returns
{"document": {"_id": "user_alice", "name": "Alice", "role": "admin", "active": true}}
Usage
get_document(collection="users", document_id="user_alice")

delete_document

Delete a single document by ID from a collection.

ParameterTypeRequiredDescription
collectionstrrequiredCollection containing the document
document_idstrrequiredDocument ID to delete
Returns
{"deleted": true, "document_id": "user_alice"}
Usage
delete_document(collection="users", document_id="user_alice")

Full-Text Search 3 tools

index_fulltext

Add or update a document in a full-text search index. The index is created automatically on first use. Uses BM25 ranking for retrieval.

ParameterTypeRequiredDescription
index_namestrrequiredName of the FTS index
doc_idstrrequiredUnique document identifier within the index
documentstrrequiredPlain text content to index
Returns
{"success": true, "index_name": "articles", "doc_id": "article_001"}
Usage
index_fulltext(
  index_name="articles",
  doc_id="article_001",
  document="PolyDB supports 16 data models with pluggable backends."
)

search_fulltext

Search a full-text index using BM25 relevance ranking. Supports multi-word queries with implicit AND semantics.

ParameterTypeRequiredDescription
index_namestrrequiredName of the FTS index to search
querystrrequiredSearch query string
limitintoptional (default 10)Maximum results to return
Returns
{"results": [{"id": "article_001", "score": 0.92, "snippet": "..."}], "count": 1, "query": "pluggable backends"}
Usage
search_fulltext(index_name="articles", query="pluggable backends", limit=5)

delete_fulltext

Remove a document from a full-text search index by its document ID.

ParameterTypeRequiredDescription
index_namestrrequiredName of the FTS index
doc_idstrrequiredDocument ID to remove
Returns
{"deleted": true, "index_name": "articles", "doc_id": "article_001"}
Usage
delete_fulltext(index_name="articles", doc_id="article_001")

Graph 5 tools

add_graph_node

Add a node to the graph with optional typed properties. Nodes are identified by a unique string ID. If the node already exists, its properties are updated.

ParameterTypeRequiredDescription
node_idstrrequiredUnique node identifier
propertiesDictoptionalKey-value properties for the node
node_typestroptionalSemantic type label (e.g. "Person", "Service")
Returns
{"node_id": "user_alice", "success": true}
Usage
add_graph_node(
  node_id="user_alice",
  node_type="Person",
  properties={"name": "Alice", "department": "Engineering"}
)

add_graph_edge

Add a directed edge between two existing nodes. The edge may carry a type label and arbitrary properties.

ParameterTypeRequiredDescription
from_nodestrrequiredSource node ID
to_nodestrrequiredTarget node ID
edge_typestroptionalRelationship type, e.g. "KNOWS", "DEPENDS_ON"
propertiesDictoptionalKey-value properties for the edge
Returns
{"edge_id": "edge_abc123", "success": true}
Usage
add_graph_edge(
  from_node="user_alice",
  to_node="user_bob",
  edge_type="KNOWS",
  properties={"since": "2024-01-01"}
)

query_graph

Traverse the graph starting from a node using a named pattern. Supported patterns include "neighbors", "shortest_path", and "subgraph". Depth controls traversal levels.

ParameterTypeRequiredDescription
start_nodestrrequiredNode ID to start traversal from
patternstroptional (default "neighbors")Traversal pattern: "neighbors", "shortest_path", "subgraph"
depthintoptional (default 1)Maximum traversal depth
Returns
{"results": [{"node_id": "user_bob", "distance": 1}], "pattern": "neighbors", "depth": 1}
Usage
query_graph(start_node="user_alice", pattern="neighbors", depth=2)

delete_graph_node

Delete a node and all its incident edges from the graph.

ParameterTypeRequiredDescription
node_idstrrequiredNode ID to delete
Returns
{"deleted": true, "node_id": "user_alice"}
Usage
delete_graph_node(node_id="user_alice")

delete_graph_edge

Delete a specific edge by its ID.

ParameterTypeRequiredDescription
edge_idstrrequiredEdge ID to delete (returned by add_graph_edge)
Returns
{"deleted": true, "edge_id": "edge_abc123"}
Usage
delete_graph_edge(edge_id="edge_abc123")

Iceberg 5 tools

create_iceberg_table

Create an Apache Iceberg-format table with a declared schema, optional partition spec, and table properties. Supports schema evolution and time-travel queries.

ParameterTypeRequiredDescription
table_namestrrequiredUnique table name
schemadictrequiredColumn definitions, e.g. {"id": "long", "ts": "timestamp", "amount": "double"}
partition_byList[str]optionalColumn names to partition on
propertiesDictoptionalTable-level properties
Returns
{"table_id": "tbl_001", "table_name": "events"}
Usage
create_iceberg_table(
  table_name="events",
  schema={"id": "long", "ts": "timestamp", "event_type": "string", "payload": "string"},
  partition_by=["event_type"]
)

append_iceberg

Append a batch of records to an Iceberg table. Each append creates an immutable snapshot that can be queried independently for time-travel.

ParameterTypeRequiredDescription
tablestrrequiredTarget Iceberg table name
data_recordsList[dict]requiredList of row objects matching the table schema
Returns
{"snapshot_id": "snap_20240101_001", "record_count": 1000}
Usage
append_iceberg(
  table="events",
  data_records=[
    {"id": 1, "ts": "2024-01-01T00:00:00Z", "event_type": "click", "payload": "{}"},
    {"id": 2, "ts": "2024-01-01T00:00:01Z", "event_type": "view",  "payload": "{}"}
  ]
)

get_iceberg_snapshot_as_of

Time-travel query: retrieve the state of an Iceberg table as it existed at a specific timestamp. Useful for auditing, reproducibility, and debugging.

ParameterTypeRequiredDescription
tablestrrequiredIceberg table name
timestampstrrequiredISO 8601 timestamp, e.g. "2024-01-01T12:00:00Z"
Returns
{"snapshot_id": "snap_20240101_001", "timestamp": "2024-01-01T12:00:00Z", "records": [...]}
Usage
get_iceberg_snapshot_as_of(table="events", timestamp="2024-01-01T12:00:00Z")

add_iceberg_column

Add a new column to an existing Iceberg table schema. Existing snapshots are unaffected; the new column returns null for rows predating the schema change.

ParameterTypeRequiredDescription
tablestrrequiredIceberg table name
column_namestrrequiredNew column name
column_typestrrequiredData type, e.g. "string", "long", "double", "boolean"
requiredbooloptional (default false)Whether the column is required (non-nullable)
Returns
{"table": "events", "column_name": "user_id", "column_type": "string"}
Usage
add_iceberg_column(table="events", column_name="user_id", column_type="string")

expire_iceberg_snapshots

Remove old snapshots from an Iceberg table to reclaim storage, retaining only the most recent N snapshots. The latest snapshot is always retained.

ParameterTypeRequiredDescription
tablestrrequiredIceberg table name
retain_last_nintoptional (default 1)Number of most recent snapshots to keep
Returns
{"table": "events", "retain_last_n": 5}
Usage
expire_iceberg_snapshots(table="events", retain_last_n=5)

Key-Value 4 tools

set_keyvalue

Store any JSON-serialisable value under a key in a namespace. Supports optional TTL (seconds) for automatic expiry.

ParameterTypeRequiredDescription
keystrrequiredKey string
valueAnyrequiredJSON-serialisable value
namespacestroptional (default "default")Logical namespace for key isolation
ttlintoptionalTime-to-live in seconds; omit for no expiry
Returns
{"success": true, "key": "session:abc", "namespace": "sessions", "ttl": 3600}
Usage
set_keyvalue(key="session:abc", value={"user_id": 42}, namespace="sessions", ttl=3600)

get_keyvalue

Retrieve the value associated with a key in a namespace. Returns null value if the key does not exist or has expired.

ParameterTypeRequiredDescription
keystrrequiredKey to look up
namespacestroptional (default "default")Namespace to look up within
Returns
{"key": "session:abc", "namespace": "sessions", "value": {"user_id": 42}}
Usage
get_keyvalue(key="session:abc", namespace="sessions")

delete_keyvalue

Delete a key-value pair from a namespace.

ParameterTypeRequiredDescription
keystrrequiredKey to delete
namespacestroptional (default "default")Namespace to delete from
Returns
{"deleted": true, "key": "session:abc", "namespace": "sessions"}
Usage
delete_keyvalue(key="session:abc", namespace="sessions")

list_keyvalues

List all non-expired keys in a namespace.

ParameterTypeRequiredDescription
namespacestroptional (default "default")Namespace to list keys from
Returns
{"keys": ["session:abc", "session:def"], "count": 2, "namespace": "sessions"}
Usage
list_keyvalues(namespace="sessions")

Memory 3 tools

store_memory

Persist an agent interaction (input + response pair) to long-term memory. The interaction is vectorised and stored with session context for later semantic retrieval.

ParameterTypeRequiredDescription
user_inputstrrequiredThe user's input text
llm_responsestrrequiredThe LLM's response text
session_idstroptionalSession grouping identifier
interaction_typestroptional (default "conversation")Type label: "conversation", "task", "feedback"
metadataDictoptionalAdditional context metadata
Returns
{"memory_id": "mem_001", "interaction_id": "int_001", "vector_id": "vec_001", "session_id": "sess_abc"}
Usage
store_memory(
  user_input="What is PolyDB?",
  llm_response="PolyDB is a multi-model database...",
  session_id="sess_abc",
  interaction_type="conversation"
)

recall_memory

Retrieve relevant memory context using semantic similarity search. Optionally filter by session and interaction types. Returns ranked context items for injection into prompts.

ParameterTypeRequiredDescription
querystrrequiredSemantic search query
session_idstroptionalLimit recall to a specific session
context_typesList[str]optionalFilter by interaction types
max_itemsintoptional (default 10)Maximum context items to return
Returns
{"context_items": [{"memory_id": "mem_001", "score": 0.91, "content": "..."}], "total_items": 1}
Usage
recall_memory(query="multi-model database", session_id="sess_abc", max_items=5)

delete_memory

Delete a stored memory interaction by its ID.

ParameterTypeRequiredDescription
memory_idstrrequiredMemory ID to delete (from store_memory response)
Returns
{"deleted": true, "memory_id": "mem_001"}
Usage
delete_memory(memory_id="mem_001")

Knowledge 3 tools

store_knowledge

Store a structured knowledge item with type classification, source provenance, and confidence score. Knowledge is vectorised and indexed for semantic retrieval.

ParameterTypeRequiredDescription
contentstrrequiredKnowledge content text
knowledge_typestroptional (default "semantic")"semantic", "factual", "procedural", "episodic"
sourcestroptionalSource URL, document name, or identifier
confidencefloatoptional (default 1.0)Confidence score 0.0–1.0
metadataDictoptionalAdditional metadata
Returns
{"knowledge_id": "know_001", "content_length": 120, "knowledge_type": "factual"}
Usage
store_knowledge(
  content="PolyDB supports 16 data models including Vector, Graph, and Time Series.",
  knowledge_type="factual",
  source="https://polydb.dev/docs",
  confidence=1.0
)

search_knowledge

Semantically search stored knowledge items by query, filtered by knowledge type and minimum confidence threshold.

ParameterTypeRequiredDescription
querystrrequiredSemantic search query
knowledge_typesList[str]optionalFilter by knowledge type(s)
min_confidencefloatoptional (default 0.5)Minimum confidence threshold
limitintoptional (default 10)Maximum results to return
Returns
{"results": [{"knowledge_id": "know_001", "score": 0.95, "content": "..."}], "total_results": 1}
Usage
search_knowledge(query="data models", knowledge_types=["factual"], min_confidence=0.8, limit=5)

delete_knowledge

Delete a stored knowledge item by its ID.

ParameterTypeRequiredDescription
knowledge_idstrrequiredKnowledge ID to delete
Returns
{"deleted": true, "knowledge_id": "know_001"}
Usage
delete_knowledge(knowledge_id="know_001")

S3 7 tools

Lifecycle: create_bucketput_s3_objectget_s3_object / list_s3_objectsdelete_s3_objectdelete_bucket. list_buckets is read-only and can be called any time.

create_bucket

Create an S3 bucket. Idempotent — safe to call even if the bucket already exists. Call this first; every other S3 tool depends on a bucket existing.

ParameterTypeRequiredDescription
bucketstrrequiredBucket name (3-63 chars, lowercase letters/digits/hyphens/dots)
regionstroptionalAWS region hint; defaults to tenant S3 config region
Returns (first creation)
{"created": true, "bucket": "my-bucket", "region": "us-east-1"}
Returns (already exists — idempotent no-op)
{"created": false, "already_existed": true, "bucket": "my-bucket", "region": "us-east-1"}
Usage
create_bucket(bucket="my-bucket")

put_s3_object

Upload an object to a named S3-compatible bucket. The content is stored as-is with the specified content type. The bucket must already exist — call create_bucket first.

ParameterTypeRequiredDescription
bucketstrrequiredBucket name
keystrrequiredObject key (path within bucket)
contentstrrequiredObject content (text or base64)
content_typestroptionalMIME type, e.g. "application/json"
Returns
{"success": true, "bucket": "my-bucket", "key": "data/report.json", "size": 1024}
Usage
put_s3_object(
  bucket="my-bucket",
  key="data/report.json",
  content="{\"total\": 42}",
  content_type="application/json"
)

get_s3_object

Retrieve an object from a bucket by key.

ParameterTypeRequiredDescription
bucketstrrequiredBucket name
keystrrequiredObject key to retrieve
Returns
{"content": "{\"total\": 42}", "content_type": "application/json", "content_length": 13}
Usage
get_s3_object(bucket="my-bucket", key="data/report.json")

list_s3_objects

List objects in a bucket, optionally filtered by key prefix.

ParameterTypeRequiredDescription
bucketstrrequiredBucket name
prefixstroptionalKey prefix filter, e.g. "data/"
Returns
{"objects": [{"key": "data/report.json", "size": 1024, "last_modified": "2024-01-01T00:00:00Z"}], "count": 1, "bucket": "my-bucket"}
Usage
list_s3_objects(bucket="my-bucket", prefix="data/")

delete_s3_object

Delete an object from a bucket.

ParameterTypeRequiredDescription
bucketstrrequiredBucket name
keystrrequiredObject key to delete
Returns
{"deleted": true, "bucket": "my-bucket", "key": "data/report.json"}
Usage
delete_s3_object(bucket="my-bucket", key="data/report.json")

delete_bucket

Delete an S3 bucket. The bucket must be empty before deletion. Delete all objects first with delete_s3_object, then call this tool.

ParameterTypeRequiredDescription
bucketstrrequiredBucket name to delete
Returns
{"success": true, "bucket": "my-bucket"}
Usage
delete_bucket(bucket="my-bucket")

list_buckets

List all S3 buckets belonging to the authenticated tenant. Bucket names are tenant-scoped — each tenant's buckets are isolated from other tenants.

ParameterTypeRequiredDescription
No parameters
Returns
{"buckets": [{"name": "my-bucket", "created_at": "2026-04-29T12:00:00Z"}], "count": 1}
Usage
list_buckets()

Spatial 4 tools

store_spatial

Store a geospatial geometry (GeoJSON or WKT string) in a named spatial table along with arbitrary attribute data.

ParameterTypeRequiredDescription
table_namestrrequiredSpatial table to store the feature in
geometrystr|DictrequiredGeoJSON object or WKT string
attributesDictoptionalFeature attributes, e.g. {"name": "HQ", "category": "office"}
Returns
{"feature_id": "feat_001", "table_name": "locations"}
Usage
store_spatial(
  table_name="locations",
  geometry={"type": "Point", "coordinates": [-0.1278, 51.5074]},
  attributes={"name": "London HQ", "category": "office"}
)

search_spatial_nearby

Find spatial features within a given radius of a point. Results are ordered by distance.

ParameterTypeRequiredDescription
table_namestrrequiredSpatial table to search
longitudefloatrequiredCenter longitude (WGS84)
latitudefloatrequiredCenter latitude (WGS84)
radius_metersfloatrequiredSearch radius in metres
limitintoptional (default 10)Maximum features to return
Returns
{"results": [{"feature_id": "feat_001", "distance": 234.5, "attributes": {...}}], "count": 1, "search_point": {"longitude": -0.1278, "latitude": 51.5074}}
Usage
search_spatial_nearby(
  table_name="locations",
  longitude=-0.1278,
  latitude=51.5074,
  radius_meters=1000,
  limit=20
)

search_spatial_bbox

Find spatial features that intersect or fall within a bounding box defined by min/max longitude and latitude coordinates.

ParameterTypeRequiredDescription
table_namestrrequiredSpatial table to search
min_lonfloatrequiredWestern boundary longitude
min_latfloatrequiredSouthern boundary latitude
max_lonfloatrequiredEastern boundary longitude
max_latfloatrequiredNorthern boundary latitude
limitintoptional (default 10)Maximum features to return
Returns
{"results": [{"feature_id": "feat_001", "attributes": {...}}], "count": 1, "bbox": [-0.15, 51.49, -0.10, 51.52]}
Usage
search_spatial_bbox(
  table_name="locations",
  min_lon=-0.15, min_lat=51.49,
  max_lon=-0.10, max_lat=51.52
)

delete_spatial

Delete a spatial feature from a table by its feature ID.

ParameterTypeRequiredDescription
table_namestrrequiredSpatial table containing the feature
feature_idstrrequiredFeature ID to delete
Returns
{"deleted": true, "feature_id": "feat_001"}
Usage
delete_spatial(table_name="locations", feature_id="feat_001")

SQL 1 tool

query_sql

Execute a read-only SQL statement against the underlying backend. Only SELECT, WITH (CTEs), EXPLAIN, and SHOW statements are permitted. Write operations are rejected. Parameterised queries are recommended to prevent injection. Parameters use ? placeholders — PostgreSQL-style $1/$N syntax is not supported. Queries against pg_* and information_schema system tables are also rejected.

ParameterTypeRequiredDescription
querystrrequiredSQL SELECT / WITH / EXPLAIN / SHOW statement
paramsListoptionalPositional parameters for parameterised queries
Returns
{"rows": [{"id": 1, "name": "Alice"}], "columns": ["id", "name"], "count": 1}
Usage
query_sql(
  query="SELECT id, name FROM users WHERE role = ?",
  params=["admin"]
)

Stream 2 tools

publish_stream

Publish an event to a named stream. The event is appended to the stream log with a server-assigned sequence number and timestamp.

ParameterTypeRequiredDescription
stream_namestrrequiredStream to publish to (created on first publish)
event_dataDictrequiredEvent payload as a JSON object
Returns
{"success": true, "stream_name": "user-events"}
Usage
publish_stream(
  stream_name="user-events",
  event_data={"type": "login", "user_id": 42, "ip": "1.2.3.4"}
)

consume_stream

Read and consume up to N events from a stream. Consumed events are removed from the head of the stream.

ParameterTypeRequiredDescription
stream_namestrrequiredStream to consume from
limitintoptional (default 10)Maximum events to consume
Returns
{"events": [{"event_id": "evt_001", "event_type": "login", "payload": {"type": "login"}, "timestamp": "2024-01-01T00:00:00Z", "ingested_at": "2024-01-01T00:00:00Z", "created_at": "2024-01-01T00:00:00Z", "sequence_id": 1}], "count": 1}
Usage
consume_stream(stream_name="user-events", limit=50)

Temporal 3 tools

store_temporal

Store a versioned snapshot of an entity. Each call creates a new immutable version. If no timestamp is provided, the current UTC time is used.

ParameterTypeRequiredDescription
entity_idstrrequiredUnique entity identifier
dataDictrequiredEntity state at this version
timestampstroptionalISO 8601 timestamp; defaults to now
Returns
{"entity_id": "config:app", "version_id": "ver_003", "version_number": 3}
Usage
store_temporal(
  entity_id="config:app",
  data={"max_connections": 100, "timeout_ms": 5000},
  timestamp="2024-06-01T09:00:00Z"
)

query_temporal_at

Retrieve the state of an entity at a specific point in time. Returns the version whose timestamp is closest to and not after the requested time.

ParameterTypeRequiredDescription
entity_idstrrequiredEntity identifier
timestampstrrequiredISO 8601 timestamp to query at
Returns
{"entity_id": "config:app", "timestamp": "2024-06-01T09:00:00Z", "data": {"max_connections": 100}}
Usage
query_temporal_at(entity_id="config:app", timestamp="2024-06-01T09:00:00Z")

query_temporal_history

Retrieve all versions of an entity between two timestamps, ordered chronologically.

ParameterTypeRequiredDescription
entity_idstrrequiredEntity identifier
start_timestrrequiredISO 8601 range start (inclusive)
end_timestrrequiredISO 8601 range end (inclusive)
Returns
{"history": [{"version": 2, "ts": "...", "data": {...}}, {"version": 3, "ts": "...", "data": {...}}], "count": 2}
Usage
query_temporal_history(
  entity_id="config:app",
  start_time="2024-01-01T00:00:00Z",
  end_time="2024-12-31T23:59:59Z"
)

Time Series 2 tools

store_timeseries

Record a single time-series data point for a named metric. Optionally attach tags for multi-dimensional filtering. If no timestamp is given, server time is used.

ParameterTypeRequiredDescription
metricstrrequiredMetric name, e.g. "cpu_percent"
valuefloatrequiredNumeric measurement value
timestampstroptionalISO 8601 timestamp; defaults to now
tagsDictoptionalDimension tags, e.g. {"host": "web-01", "region": "eu-west"}
Returns
{"success": true, "metric": "cpu_percent", "value": 72.3}
Usage
store_timeseries(
  metric="cpu_percent",
  value=72.3,
  tags={"host": "web-01", "region": "eu-west"}
)

query_timeseries

Query a time-series metric over a time range with server-side aggregation. Supported aggregations: avg, sum, min, max, count.

ParameterTypeRequiredDescription
metricstrrequiredMetric name to query
start_timestrrequiredISO 8601 range start
end_timestrrequiredISO 8601 range end
aggregationstroptional (default "avg")"avg", "sum", "min", "max", "count"
Returns
{"results": [{"ts": "2024-01-01T00:00:00Z", "value": 68.4}], "count": 1, "metric": "cpu_percent"}
Usage
query_timeseries(
  metric="cpu_percent",
  start_time="2024-01-01T00:00:00Z",
  end_time="2024-01-01T01:00:00Z",
  aggregation="avg"
)

Transaction coming soon

Cross-model ACID transaction tools (begin_transaction, execute_transactional, commit_transaction, rollback_transaction) are under active development and will be available in an upcoming release. Single-operation SQL transactions are available today via query_sql.

Vector 3 tools

store_vector

Store a dense embedding vector in a named collection. Attach metadata for filtering during similarity search. If no vector_id is provided, one is auto-generated.

ParameterTypeRequiredDescription
collectionstrrequiredCollection name (created automatically if absent)
vectorList[float]requiredDense embedding (e.g. 1536-dim for text-embedding-3-small)
vector_idstroptionalCustom vector ID; auto-generated if omitted
metadataDictoptionalFilterable metadata attached to the vector
Returns
{"vector_id": "vec_001"}
Usage
store_vector(
  collection="documents",
  vector=[0.021, -0.045, 0.103, ...],  # 1536 floats
  metadata={"doc_id": "article_001", "source": "blog"}
)

search_vectors

Find the K nearest vectors to a query vector using pgvector. Returns vector IDs, distances, and attached metadata. Note: results use distance (lower is closer), not a score field — this follows the pgvector convention.

ParameterTypeRequiredDescription
collectionstrrequiredCollection to search
query_vectorList[float]requiredQuery embedding (must match stored dimension)
kintoptional (default 5)Number of nearest neighbours to return
Returns
{"results": [{"vector_id": "vec_001", "distance": 0.03, "metadata": {"doc_id": "article_001"}}], "count": 1}
Usage
search_vectors(
  collection="documents",
  query_vector=[0.021, -0.045, 0.103, ...],
  k=10
)

delete_vector

Delete a stored vector from a collection by its ID.

ParameterTypeRequiredDescription
collectionstrrequiredCollection containing the vector
vector_idstrrequiredVector ID to delete
Returns
{"deleted": true, "vector_id": "vec_001"}
Usage
delete_vector(collection="documents", vector_id="vec_001")

Workflow 1 tool

execute_workflow Pro / Enterprise

Execute a multi-step workflow where each step calls a PolyDB tool. Steps can reference outputs from prior steps using $ref(step_id.field) to chain step outputs as inputs to later steps. All steps execute sequentially; the first failure stops the chain and is reported in errors. Available on Pro and Enterprise plans. Note: $embed(text) server-side embedding is coming soon.

ParameterTypeRequiredDescription
stepsList[dict]requiredOrdered list of step objects with keys: id (str), op (tool name), args (dict)
Returns
{"results": {"step1": {"document_id": "doc_001"}, "step2": {"vector_id": "vec_001"}}, "completed": 2, "total": 2, "errors": []}
Usage
execute_workflow(steps=[
  {
    "id": "store_doc",
    "op": "store_document",
    "args": {"collection": "articles", "document": {"title": "Hello"}}
  },
  {
    "id": "store_vec",
    "op": "store_vector",
    "args": {
      "collection": "embeddings",
      "vector": [0.1, 0.2, 0.3],
      "metadata": {"doc_id": "$ref(store_doc.document_id)"}
    }
  }
])

Schema 1 tool

search_schema

Discover all available tools and their signatures. Use this as a first call to understand what capabilities are available. Optionally filter by provider name or keyword.

ParameterTypeRequiredDescription
filterstroptionalKeyword to filter tools by name or description
Returns
{"tools": [{"name": "store_vector", "provider": "vector", "description": "..."}, ...], "total": 59, "filter_applied": null}
Usage
# Discover all tools
search_schema()

# Filter to vector-related tools
search_schema(filter="vector")

System 2 tools

health_check

Health probe for the PolyDB MCP server. Returns service identity, version, and transport so a client can verify connectivity and version-pin its calls.

ParameterTypeRequiredDescription
(no parameters)
Returns
{"status": "healthy", "service": "polydb-mcp-server", "version": "0.9.x", "transport": "streamable-http"}
Usage
health_check()

list_databases

Read-only discovery tool that enumerates the databases available to the current tenant. The tenant’s default/current database is flagged with current: true. To create or delete databases, use the REST API at /api/databases — this MCP tool is read-only. A brand-new tenant whose default DB has not yet been materialized via the REST endpoint will see an empty list; call POST /api/databases first.

To target a specific database for a tool call, supply the database argument on the tool (e.g. store_document(..., database='analytics')), or set X-PolyDB-Database: <name> as a request header. To change the persistent default, use PATCH /api/databases/{name}/default.

ParameterTypeRequiredDescription
(no parameters)
Returns
{"databases": [{"name": "polydb", "current": true, "created_at": "2026-04-01T00:00:00+00:00"}, ...]}
Usage
list_databases()