Integrations & Tools
~9 min readUpdated: December 2026

Dependency-Complete Tool Discovery for Versioned MCP Enterprise Agents

Dependency-Complete MCP Tool Discovery Graph and Versioned Contract Verification in Smoke Monkey

Standard lexical and history-based tool retrieval regularly pulls a target MCP operation while omitting prerequisite auth, schema, or state-mutation tools. arXiv:2612.01375 formalizes version-conditioned executable support and evaluates dependency-guided discovery with source-bound index reuse across 72 contexts and 336 enterprise lifecycles, jumping feasible support from 30/72 to 60/72 while cutting logical index input by 35.93%.

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

Dependency-Complete Tool Discovery for Versioned MCP Enterprise Agents: Standard lexical and history-based tool retrieval regularly pulls a target MCP operation while omitting prerequisite auth, schema, or state-mutation tools. arXiv:2612.01375 formalizes version-conditioned executable support and evaluates dependency-guided discovery with source-bound index reuse across 72 contexts and 336 enterprise lifecycles, jumping feasible support from 30/72 to 60/72 while cutting logical index input by 35.93%. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.

Key Architectural Takeaways
Quick Implementation Exampledependency-complete-mcp-discovery.ts
dependency-complete-mcp-discovery.tstypescript
import { createAgent } from '@smoke-monkey/harness';
// Source-bound MCP tool closure resolver before binding tools into Smoke Monkey Harness
interface ToolNode {
name: string;
versionDigest: string;
requires: string[];
}
function expandDependencyClosure(seeds: string[], catalog: Record<string, ToolNode>, cap = 24): string[] {
const closure = new Set<string>();
const queue = [...seeds];
while (queue.length > 0 && closure.size < cap) {
const id = queue.shift()!;
if (closure.has(id) || !catalog[id]) continue;
closure.add(id);
for (const dep of catalog[id].requires) {
if (!closure.has(dep)) queue.push(dep);
}
}
return [...closure];
}
const agent = createAgent({
agentId: 'dependency-verified-mcp-runner',
provider: 'openai-compatible',
model: 'Qwen/Qwen3-32B',
baseUrl: process.env.VLLM_BASE_URL || 'http://127.0.0.1:8000/v1',
apiKey: process.env.VLLM_API_KEY || 'local-key',
workspacePath: process.cwd(),
permissions: {
read_file: 'allow',
write_file: 'allow',
run_command: 'ask',
},
});
async function main() {
const catalog: Record<string, ToolNode> = {
book_flight: { name: 'book_flight', versionDigest: 'sha256:9b1a', requires: ['authenticate_session', 'lock_fare_quote'] },
lock_fare_quote: { name: 'lock_fare_quote', versionDigest: 'sha256:4c2e', requires: ['authenticate_session'] },
authenticate_session: { name: 'authenticate_session', versionDigest: 'sha256:1f08', requires: [] },
};
const exposedTools = expandDependencyClosure(['book_flight'], catalog);
const result = await agent.run(`Verify exposed MCP tool closure [${exposedTools.join(', ')}] and test booking contract.`);
console.log('Verified MCP closure result:', result.summary);
}
main().catch(console.error);
Video Guides

Watch: Related Video Guides

Build an MCP-Based Tool Discovery Agent (Step-by-Step)

What is MCP? Integrate AI Agents with Databases & APIs

Why Standard Top-k Tool Retrieval Breaks Multi-Step Enterprise Workflows

When enterprise Model Context Protocol (MCP) registries grow beyond 24–100 tools, injecting every schema bloats context and degrades routing accuracy. Yet naive top-k lexical or dense retrieval selects the final action tool (such as submit_order or cancel_reservation) while omitting prerequisite state-setup tools (authentication tokens, draft creation, lock acquisition, or compliance checks).

In arXiv:2612.01375, researchers evaluated six retrieval and discovery methods across 72 versioned contexts and 336 source-derived lifecycles (ticket, trading, retail, and airline APIs). Multi-round lexical retrieval (L) and history-conditioned retrieval (H) exposed executable support on only 36/72 initial versions and 30/72 revised versions—half of the feasible workload.

Discovery MethodOld Version SupportRevised Version SupportLifecycle Bytes (Full Exposure)Index Input Bytes
Lexical Retrieval (`L`)36 / 7230 / 727,322,718N/A (72 calls)
History-Conditioned (`H`)36 / 7230 / 727,233,232N/A (72 calls)
State-Dependency Expansion (`S`)72 / 7260 / 726,203,4405,406,796
Full Rediscovery (`F`)72 / 7260 / 726,753,7355,406,796
Incremental Completion (`I`)72 / 7260 / 725,056,5313,622,020 (-33.0%)

Versioned Contract Certification vs Simple Index Caching

Tool schemas mutate silently across deployments: an API revision can drop a required precondition or introduce a new authorization step while keeping the same tool name.

  1. Dependency-Guided Closure: Expand each candidate tool backward through its requires preconditions using a bounded planner before exposing the subset to the LLM.
  2. Source-Bound Index Reuse: Bind cached dependency edges to cryptographic source digests of the tool body and schema. When catalogs update, re-index only modified bodies—cutting logical indexing input by 35.93% on real catalogs while retaining 18/24 vs 19/24 goal completions on Qwen3-32B.
  3. Explicit Stop Conditions: Separate *missing capability*, *exposure-cap overflow* (e.g., >24-tool budget), and *search truncation* so agents fail closed rather than hallucinating missing parameters.

Version Fingerprints Are Not Business Proofs

A matching tool version digest certifies schema and dependency retention—not downstream business authorization. Keep runtime RBAC and permission gates inside the execution harness.

Auditing Your MCP Server Catalog for Missing Prerequisites

Run a local topological dependency check across your mcpServers JSON manifests before deploying a new tool revision:

bash
# Validate every tool precondition edge resolves inside the active MCP exposure budget
node -e '
const fs = require("fs");
const catalog = JSON.parse(fs.readFileSync(process.argv[1] || "mcp-catalog.json", "utf8"));
const names = new Set(catalog.tools.map(t => t.name));
const missing = [];
for (const t of catalog.tools) {
  for (const dep of (t.requires || [])) {
    if (!names.has(dep)) missing.push(`${t.name} -> missing ${dep}`);
  }
}
console.log(missing.length ? { status: "BROKEN", missing } : { status: "COMPLETE", count: names.size });
' mcp-catalog.json

Wire validated dependency closures into Smoke Monkey Canvas so worker agents automatically mount prerequisite auth and state tools whenever they claim a downstream workflow.

Google Search Questions & Answers

Frequently Asked Questions

Q:Why does lexical or vector RAG fail for MCP tool discovery?

Top-k semantic search matches keywords in the goal operation (like refund_order) but often omits prerequisite setup tools (like verify_identity or fetch_ledger) that lack overlapping wording.

Q:How much indexing work does source-bound incremental completion save?

In arXiv:2612.01375, incremental completion reduced index input bytes by 33.0% on the finite matrix and reduced logical indexing input by 35.93% on real ticket, trading, retail, and airline catalogs.

Q:How does Qwen3-32B perform compared to Llama-3.1-70B-Instruct in the study?

Across 24 held-out roots, Qwen3-32B completed 19/24 revised goals under full rediscovery and 18/24 under cached incremental completion, whereas Llama-3.1-70B-Instruct completed 6/24 under both.

Q:Does caching dependency graphs ever hurt safety?

Only if caches ignore schema edits. Source-bound reuse ties every cached edge to the tool body digest and re-validates runtime contracts when revisions change.

Related Alternatives & Comparisons

Related Architecture Guides

View all guides

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness