Skip to main content

graph-tool-call documentation

graph-tool-call is a graph-structured tool retrieval engine for LLM agents. It turns OpenAPI specs, MCP tools, and Python functions into searchable tool graphs, then returns compact candidates, execution contracts, target-selection evidence, and quality diagnostics.

Use this manual when your agent has more tools than can safely fit in model context, or when "the right tool" depends on request fields, response fields, workflow order, auth readiness, and past run evidence.

Choose Your Path

GoalStart HereYou Should End With
Try the library locallyQuickstarta first OpenAPI search, graph build, and readiness check
Understand the architectureMental Modelthe ingest -> contract -> retrieve -> select -> plan -> learn model
Build from Swagger/OpenAPIOpenAPI Ingestiona collection artifact with contracts and semantic metadata
Search a large catalogTool Graph Searchranked candidates with score/evidence output
Guard an LLM target choiceTarget Selectiondeterministic selector diagnostics around llm_target
Execute multi-tool workflowsPlan Synthesisa plan, user input slots, runner events, and failure reasons
Validate qualityQuality Labrepeatable search, plan, execute, and benchmark gates
Connect an applicationXGEN Integrationa product adapter that owns DB, auth, UI, SSE, and execution
Pick a public APIAPI Cheat Sheetthe stable function or CLI command for each workflow

Minimal Retrieval

from graph_tool_call import ToolGraph

graph = ToolGraph.from_url("https://petstore3.swagger.io/api/v3/openapi.json")
results = graph.retrieve_with_scores("find pets by status", top_k=3)

for row in results:
print(row.tool.name, row.score)

For debugging, request the evidence object rather than sending every tool schema to the LLM:

from graph_tool_call.graphify import retrieve_graphify

response = retrieve_graphify(
graph,
"find pets by status",
top_k=3,
include_evidence=True,
)

first = response["results"][0]
print(first["score_breakdown"])

Core Workflows

WorkflowManualKey Artifacts
Build catalogBuild Tool CatalogsToolSchema, api_contract, semantic_summary, readiness report
Search and selectSearch And Selectionretrieval rows, score breakdown, target_selector
Plan and executePlan And ExecutePlan, PlanStep, user_input_slots, runner events
Learn from tracesLearning Loopscrubbed attempts, suggestions, shadow/promotion state
Validate claimsValidationbenchmark artifacts, Quality Lab results, release gates
Integrate clientsIntegrationsXGEN adapter, MCP gateway, LangChain tools, middleware patches
Look up contractsReferencepublic imports, CLI, event schemas, report schemas

What The Engine Owns

The library is product-neutral. It should own deterministic graph/search/plan logic and artifacts that can be inspected or tested.

Engine ResponsibilityProduct Adapter Responsibility
OpenAPI/MCP/Python ingestionsource storage and tenant policy
request/response contract extractionuser/session auth resolution
retrieval and score evidencemodel/provider routing
target selector diagnosticsUI decisions and user confirmation
plan synthesis and runner event schemaactual HTTP execution and audit logging
trace-learning suggestionsapproval, rejection, and rollout policy

Quality Expectations

Good tool retrieval work should be reproducible. Before publishing a quality claim or wiring a large collection into production, make sure you have:

  • a committed fixture or named live collection
  • deterministic search/selector metrics
  • a plan/execute gate if execution is claimed
  • model/provider information for any LLM-based result
  • raw result artifacts or Quality Lab records
  • an explicit note when a benchmark is synthetic, shadow-mode, or read-only

Manual Map

SectionUse It For
Getting Startedinstallation, quickstart, mental model
Build Tool CatalogsOpenAPI, MCP, Python ingestion, semantic build, IO contracts, readiness
Search And Selectionretrieval, evidence, candidate expansion, target selector, Korean search
Plan And Executeplan synthesis, user slots, runner events, failure taxonomy
Learning Loopscrubbed traces, suggestions, shadow mode, promotion policy
Validationbenchmark gates, Quality Lab, release gates
IntegrationsXGEN, MCP, LangChain, middleware, direct API adapters
Referencepublic imports, CLI, events, reports, artifacts, compatibility