marklogic-rag

marklogic-rag is a skill for Claude Code, Codex from tternquist/marklogic-mcp. It costs 151 tokens per session (2,116 once invoked), scanned A, original, MIT.

A guide for building retrieval-augmented generation systems in MarkLogic 12. Retrieval-augmented generation means finding relevant stored information before an AI model writes an answer.

In plain words
What is it for?
Use it to store embeddings, split documents into chunks, and design lexical, vector, hybrid, or graph-based retrieval pipelines.
Why use it?
It helps choose between keyword search, embedding-based similarity, hybrid search, and knowledge-graph filtering for a given data set.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tternquist/marklogic-mcp/marklogic-rag
Any agent
npx skills add tternquist/marklogic-mcp --skill marklogic-rag
Clone the repo
git clone --depth 1 https://github.com/tternquist/marklogic-mcp

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for marklogic-rag

README.md
[![agentmods](https://agentmods.dev/badge/skills/tternquist/marklogic-mcp/marklogic-rag.svg)](https://agentmods.dev/skills/tternquist/marklogic-mcp/marklogic-rag)
Your own site
<a href="https://agentmods.dev/skills/tternquist/marklogic-mcp/marklogic-rag"><img src="https://agentmods.dev/badge/skills/tternquist/marklogic-mcp/marklogic-rag.svg" alt="Measured on agentmods" height="20"></a>
Per session 151 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,116 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00151 $0.02116
Opus 5 $0.00076 $0.01058
Sonnet 5 $0.00030 $0.00423
Haiku 4.5 $0.00015 $0.00212

Measured 3d ago against content hash e861253f0d8a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

marklogic-rag scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/marklogic-rag/SKILL.md · 161 lines

How it starts

The opening of the file, as written. The whole thing — 161 lines — stays where its author put it; the contents beside it link to each section on GitHub.

RAG on MarkLogic 12

Requires MarkLogic 12+. Check for an existing vector view first with ml_views_list and ml_schema_get_tde.

Pick a paradigm

Situation Approach
No embeddings, fast prototype Lexical RAG
Embeddings available, simple queries Pure vector (cosine)
Mixed vocabulary + semantic queries ANN hybrid (ANN + BM25)
Taxonomy / knowledge graph available Graph + Lexical
Highest precision, full infrastructure Graph + Vector

The graph layer composes with any paradigm — it only supplies a URI scope filter, so apply it before the search or ANN step.

1. Storing embeddings

Store the embedding as a JSON array of floats in an embedding field, sibling to the content fields. Carry embeddingModel, embeddingDim, and — when chunking — chunkIndex, chunkText, sourceUri.

Chunking strategy by domain: legal contracts → by clause; news articles → whole-document or paragraph; product manuals → by section.

⚠ Generate embeddings in your application tier, not in MarkLogic. xdmp.httpPost to external HTTPS embedding APIs commonly fails with tlsv1 unrecognized name (an SSL SNI limitation in MarkLogic's Java SSL client). Produce the float array outside, then store it with flux_import or ml_document_put.

2. The TDE vector column

{
  "template": {
    "context": "/",
    "collections": ["my-collection"],
    "rows": [{
      "schemaName": "my_schema",
      "viewName": "my_view",
      "columns": [
        { "name": "uri",       "scalarType": "string", "val": "xdmp:node-uri(.)" },
        { "name": "content",   "scalarType": "string", "val": "chunkText" },
        { "name": "embedding", "scalarType": "vector", "val": "array-node('embedding')",
          "dimension": "1536", "invalidValues": "reject" }
      ]
    }]
  }
}

Four rules that each cause a distinct failure:

  • "scalarType": "vector" — not "vec:vector", not "scalar". Either of those gives TDE-INVALIDTEMPLATENODEVAL.
  • "val": "array-node('embedding')" — plain "val": "embedding" atomises the array into N individual number nodes and throws XDMP-CAST.
  • "dimension" is required and must match the model output exactly, or queries fail with XDMP-DIMMISMATCH.
  • "invalidValues": "reject" — skips malformed documents instead of failing the whole view.

Read the full file on GitHub · 161 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 161 lines · 151 tokens per session scan A e861253f0d8a

Subscribe to this mod's changes

marklogic-rag is a skill published in the GitHub repository tternquist/marklogic-mcp (3 stars, last pushed 13d ago), licensed MIT. It adds 151 tokens to every session and 2,116 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

cli-anything-chromadb

Command-line interface for ChromaDB - A stateless CLI for managing vector database collections, documents, and semantic search. Designed for AI agents and automation via the ChromaDB HTTP API v2.

HKUDS/CLI-Anything · 47 tokens

mysql reporter

生成 MySQL 查询报表并生成可视化图表。当用户需要查询 MySQL 数据库并以报表形式展示结果时使用此技能,包括:统计销售数据、分析用户行为、生成业务报表、查询业务指标等。.

xerrors/Yuxi · 55 tokens

qdrant-clients-sdk

Qdrant provides client SDKs for various programming languages, allowing easy integration with Qdrant deployments.

qdrant/skills · 28 tokens

usage

Wren Engine CLI workflow guide for AI agents. Answer data questions end-to-end using the wren CLI: gather schema context, recall past queries, write SQL through the MDL semantic layer, execute, and learn from confirmed results. Use when: user asks a data question, requests a report or analysis, asks about metrics…

Canner/WrenAI · 156 tokens

dlt-connector

Connect SaaS data (HubSpot, Stripe, Salesforce, GitHub, Slack, etc.) to Wren Engine for SQL analysis. Guides the user through the full flow: install dlt, pick a SaaS source, set up credentials, run the data pipeline into DuckDB, then auto-generate a Wren semantic project from the loaded data. Use this skill whenever…

Canner/WrenAI · 158 tokens

generate-mdl

Generate a Wren MDL project by exploring a database with available tools (SQLAlchemy, database drivers, MCP connectors, or raw SQL). Guides agents through schema discovery, type normalization, and MDL YAML generation using the wren CLI. Use when: user wants to create or set up a new MDL, onboard a new data source, or…

Canner/WrenAI · 82 tokens