mcp-context-optimizer_skill

This skill reduces context window bloat by progressively disclosing MCP tools and indexing hierarchically for efficient discovery.
  • TypeScript

14

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill shunsukehayashi/miyabi --skill mcp-context-optimizer

  • SKILL.md6.7 KB

Overview

This skill optimizes MCP tool context loading by using progressive disclosure and hierarchical indexing to prevent context window bloat. It keeps a small category index always loaded, fetches tool indexes on demand, and only loads full tool schemas when required. Use it when working with large MCP collections to reduce token use and speed up tool selection.

How this skill works

The skill maintains a three-level hierarchy: a lightweight category index (always loaded), per-category tool indexes loaded on demand, and full tool schemas fetched only when executing or inspecting a specific tool. Incoming user intent is parsed to match a category, a scoped search runs inside that category, and the full tool schema is retrieved only for the chosen tool. Caching and simple routing rules reduce repeated lookups and lower token costs.

When to use it

  • Working with large MCP sets (dozens to hundreds of tools) to avoid context bloat
  • When user queries include triggers like "find tool", "search mcp", or "which tool"
  • Before running multi-step workflows that touch multiple categories
  • When response latency or token cost is a concern
  • During agent orchestration to limit per-agent context size

Best practices

  • Always start by matching the user intent to a category before broad searching
  • Call mcp_search_tools with a category filter before requesting full tool schemas
  • Cache frequently used tool schemas within the conversation context
  • Bundle related tool calls into a single workflow to reduce repeated lookups
  • Avoid loading all tool definitions up front; load schemas only when needed

Example use cases

  • User asks to check container logs: match to docker, search for logs tool, fetch schema, then execute docker_logs
  • Deploy and verify workflow: locate compose_up, network_port_check, docker_logs, and health_check across categories
  • Ambiguous request: run a broad mcp_search_tools query, review results, then narrow to a category
  • Agent orchestration: lead agent uses optimizer to hand sub-agents minimal schemas needed for tasks
  • Exploration mode: list categories first to conserve tokens and guide follow-up queries

FAQ

Use it when queries include phrases like "find tool", "search mcp", "tool lookup", "which tool", or when many tools might apply.

How much token savings can I expect?

Typical token reduction is 60–80% versus loading all tools upfront, with faster selection and execution.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational