MCP Connector

Reduce AI agent tool costs with progressive context disclosure

Ratel indexes an agent's tools and skills into BM25-searchable catalogs, loading only what each turn needs into context.

Works with openaimcp

84
Spark score
out of 100
Updated 5 days ago
Source checked Sep 17, 2026
Version ercel-ai-sdk-v0.5.0
Models
universal

Add to Favorites

Why it matters

Ratel helps AI agents dynamically load only the tools and skills needed for each turn, cutting token costs and improving accuracy by avoiding tool overload. Instead of sending every capability upfront, it indexes tools and skills into searchable catalogs that agents query on-demand using BM25 or semantic search.

Outcomes

What it gets done

01

Index tools and skills into searchable catalogs without requiring a vector database

02

Search and retrieve only relevant capabilities per agent turn using BM25 or semantic ranking

03

Inject matching tool schemas and skill instructions dynamically instead of loading everything upfront

04

Reduce per-call token usage and recover accuracy lost to context overload across local and frontier models

Source

Get it from source

Spark does not host a copy of it.

Open source

Reports

Agent outcome reports

No reports yet

Capabilities

Tools your agent gets

search_capabilities_tool

Search tool and skill indexes to find relevant capabilities for the current agent turn.

invoke_tool_tool

Invoke a registered tool by ID with the provided arguments.

get_skill_content_tool

Retrieve the full content and instructions for a specific skill.

Overview

Ratel

Ratel is a context-engineering layer that indexes an agent's tools and skills into BM25-searchable catalogs and progressively discloses only what a given turn needs via search_capabilities, invoke_tool, and get_skill_content, instead of loading every schema and instruction up front. Use it when an agent's growing tool and skill count is costing tokens and hurting tool-selection accuracy - the MCP-specific distribution lives in the separate ratel-mcp project.

What it does

Ratel is a context-engineering layer for AI agents: instead of loading every tool schema, skill, and instruction into the system prompt on every turn, it indexes tools and skills into separate catalogs that the agent searches via a search_capabilities call, then progressively discloses only the matching capabilities for that turn - tools invoked directly by id, and skill instructions only pulled into context via get_skill_content when a matching playbook is actually relevant. The stated motivation is dual: every schema and instruction sent up front is tokens paid for on every call, and model accuracy degrades as that context grows crowded with tools a given turn doesn't need, causing the model to pick the wrong option or drift off task. Retrieval defaults to BM25, the same algorithm behind most search engines, applied to schema-aware tool metadata and skill names, descriptions, and tags, described as fast and deterministic and requiring no vector database; semantic and hybrid ranking are opt-in per catalog or per call, with SDK callers registering (which embeds) and searching dense indexes asynchronously using either an in-process model or an OpenAI-compatible embedding endpoint. The core retrieval engine (ratel-ai-core) is written in Rust, with NAPI-bound TypeScript and PyO3-bound Python SDKs on top.

When to use - and when NOT to

Use it when an agent's tool and skill count has grown large enough that loading everything up front is both costing tokens on every call and measurably hurting the model's tool-selection accuracy - the project's own benchmark site documents results across local, open-source, and frontier model setups. This particular repository is the core engine plus TypeScript and Python SDKs for building your own catalog-backed agent; it is not itself the MCP-specific distribution - that is a separate related project, ratel-local (repo ratel-ai/ratel-mcp), described as "Ratel in front of your MCP setup" for coding agents specifically. A second related project, ratel-bench, is the benchmark harness behind the published results.

Inputs and outputs

A tool is registered in a ToolCatalog with an id, name, description, input and output JSON schema, and an execute function; a skill is registered in a SkillCatalog with an id, name, description, the tool ids it depends on, and a body of instructions. A minimal TypeScript setup, quoted from the source:

const catalog = new ToolCatalog();
catalog.register({
  id: "read_file",
  name: "read_file",
  description: "Read a file from local disk.",
  inputSchema: { type: "object", properties: { path: { type: "string" } } },
  outputSchema: { type: "object", properties: { contents: { type: "string" } } },
  execute: async ({ path }) => ({ contents: await readFile(path, "utf8") }),
});

Three functions are then exposed as tools to the calling agent framework: search_capabilities to search both catalogs and return focused matches, invoke_tool to call a registered tool by id, and get_skill_content to load a matching skill's full instructions only when needed.

Capabilities

Separate tool and skill indexes with BM25 keyword search by default, needing no vector database, and opt-in semantic or hybrid dense-vector search per catalog or call, backed by an in-process embedding model or any OpenAI-compatible embedding endpoint. Cross-language support via the shared Rust core: an @ratel-ai/sdk npm package, a ratel-ai PyPI package, and the ratel-ai-core crate itself. Example integrations are documented for the Vercel AI SDK and Pydantic AI.

How to install

pnpm add @ratel-ai/sdk

or

pip install ratel-ai

Building from source requires Rust stable, Node 24+, and pnpm 10.28+ for the TypeScript SDK, or Python 3.9+ with uv for the Python SDK. The ratel-ai-core engine is Apache-2.0 licensed, an explicit patent grant for the engine others embed; the SDKs, telemetry helpers, and examples are MIT licensed.

Who it's for

Developers building agent frameworks or coding-agent integrations with a large or growing number of tools and skills, who need per-turn context to stay small and accurate instead of front-loading every schema and instruction on every call, and who want that selection to work without standing up a vector database.

Source README

Ratel

Your AI agent is paying for tools it never uses. Ratel fixes that.

DocsSkillsDiscord

npm PyPI crates.io GitHub stars Discord license

Ratel hero animation

Introduction

The context engineering layer for AI agents. Selects only the tools and skills relevant to each turn, recovering accuracy lost to tool overload and cutting what you pay per call. No vector DB, no infra.

Why

  • Cost: Every tool schema, every skill, and a growing list of instructions in the system prompt are tokens you pay for on every call. Send them all up front and you pay for them all, every turn.
  • Accuracy: Models get worse as that context grows. Crowd it with tools, skills, and instructions a turn doesn't need and the model picks the wrong option and drifts off task.
  • Ratel fixes both: it indexes your tools and skills into a catalog the agent progressively discloses, searching for what each turn needs and injecting only the matching capabilities instead of loading everything up front. Constant grounding your agent always needs - a shop's address, a brand's voice - is registered as facts and pushed into context, re-injected only when it isn't already fresh in the transcript.

Across local, open-source, and frontier model setups, Ratel cuts token usage and recovers accuracy lost to tool overload, with no vector DB required. Full results: benchmark.ratel.sh

Quickstart

Guides: Quickstart · TypeScript SDK · Python SDK

Examples: Vercel AI SDK · Pydantic AI

Typescript

Install the SDK first:

pnpm add @ratel-ai/sdk

Then create and use your Catalogs:

import { readFile } from "node:fs/promises";
import {
  SkillCatalog,
  ToolCatalog,
  getSkillContentTool,
  invokeToolTool,
  searchCapabilitiesTool,
} from "@ratel-ai/sdk";

const catalog = new ToolCatalog();
catalog.register({
  id: "read_file",
  name: "read_file",
  description: "Read a file from local disk.",
  inputSchema: { type: "object", properties: { path: { type: "string" } } },
  outputSchema: { type: "object", properties: { contents: { type: "string" } } },
  execute: async ({ path }) => ({ contents: await readFile(path, "utf8") }),
});

const skills = new SkillCatalog();
skills.register({
  id: "inspect-local-file",
  name: "inspect-local-file",
  description: "Inspect a local file before answering questions about it.",
  tools: ["read_file"],
  body: "Read the requested file, then ground your answer in its contents.",
});

// use the following as tools in your agent framework
const search = searchCapabilitiesTool(catalog, skills);
const invoke = invokeToolTool(catalog);
const loadSkill = getSkillContentTool(skills);

Python

Install the SDK first:

pip install ratel-ai

Then create and use your Catalogs:

from ratel_ai import (
    ExecutableTool,
    Skill,
    SkillCatalog,
    ToolCatalog,
    get_skill_content_tool,
    invoke_tool_tool,
    search_capabilities_tool,
)

catalog = ToolCatalog()
catalog.register(ExecutableTool(
    id="read_file",
    name="read_file",
    description="Read a file from local disk.",
    input_schema={"properties": {"path": {"type": "string"}}},
    execute=lambda args: {"contents": open(args["path"]).read()},
))

skills = SkillCatalog()
skills.register(Skill(
    id="inspect-local-file",
    name="inspect-local-file",
    description="Inspect a local file before answering questions about it.",
    tools=["read_file"],
    body="Read the requested file, then ground your answer in its contents.",
))

# use the following as tools in your agent framework
search = search_capabilities_tool(catalog, skills)
invoke = invoke_tool_tool(catalog)
load_skill = get_skill_content_tool(skills)

How it works

When your agent needs to act, it calls search_capabilities. Ratel searches separate tool and skill indexes and returns focused results from each. Tools can be invoked by id; skill instructions stay out of context until the agent loads a relevant playbook with get_skill_content.

The indexes use BM25 by default, the same algorithm behind most search engines, applied to schema-aware tool metadata and skill names, descriptions, and tags. Retrieval is fast and deterministic. Semantic and hybrid ranking are opt-in per catalog or per call; SDK callers register (which embeds) and search dense indexes asynchronously, using either an in-process model or an OpenAI-compatible embedding endpoint.

Full docs

Related projects

Related open-source projects extend and validate this repository:

Project Repo What it is
ratel-local ratel-ai/ratel-mcp The local distribution for your Coding Agents: Ratel in front of your MCP setup.
ratel-bench ratel-ai/ratel-bench The benchmark harness behind benchmark.ratel.sh.

Repo layout

src/
├── core/              # ratel-ai-core — Rust retrieval engine
├── sdk/ts/            # @ratel-ai/sdk — TypeScript SDK (NAPI-bound)
├── sdk/python/        # ratel-ai — Python SDK (PyO3-bound)
├── adapters/ts-vercel-ai-sdk/ # @ratel-ai/vercel-ai-sdk — Vercel AI SDK adapter
├── adapters/ts-mastra/ # @ratel-ai/mastra — Mastra adapter
└── telemetry/         # OTel conventions + helper packages
protocol/              # catalog-source wire contract
examples/              # End-to-end SDK examples
docs/
├── adr/                # Architecture decision records
└── assets/             # Images and other static assets

Build & test

Prerequisites: Rust stable, Node 24+, pnpm 10.28+. Python SDK: Python 3.9+ and uv.

cargo build --workspace && cargo test --workspace   # Rust
pnpm install && pnpm -r build && pnpm -r test       # TypeScript
# Python: see src/sdk/python/README.md

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.