API Reference toolnexus v#0.9.4

Copy Markdown View Source

Modules

Your LLM, with MCP tools and agent skills built in — the top-level API.

A2A (agent-to-agent) — OUTBOUND: call remote A2A agents (SPEC §7A).

Provider adapters — turn the uniform tool list into each LLM's tool schema (SPEC §0.7).

A §10 answer: {id, ok, data?} — keys byte-identical across ports.

Built-in tool source (source: "builtin") — SPEC §4A.

Unified LLM client — the host loop (SPEC §8, §10).

Where ask/4 conversations are remembered — two callbacks (SPEC §8 Conversation memory).

Default conversation provider — keeps transcripts in memory for the client's lifetime.

Full outcome + telemetry of one run/ask (SPEC §8, §10).

Execution context passed to every tool (SPEC §1).

HTTP / REST tools — declare a remote endpoint as a uniform Toolnexus.Tool (SPEC §7).

Dynamic MCP source (SPEC §2, §0.2–0.4). Mirrors js/src/mcp.ts: parse an mcp.json (path | raw JSON string | map; top-level mcpServers|servers|mcp accepted), connect to every enabled server (local stdio + remote streamable-HTTP) with per-server failure isolation, list tools (cursor pagination), and expose each as a uniform Toolnexus.Tool named sanitize(server)_sanitize(tool).

One GenServer per configured MCP server (SPEC §2). Owns the transport (stdio port or streamable-HTTP state), correlates JSON-RPC request ids with per-call timeouts (config timeout, default 30000 ms), performs the initialize handshake, paginates tools/list, executes tools/call, and bridges inbound elicitation/create onto the host wait_for (§2 + §10): form → kind:"input", URL → kind:"authorization"; no wait_for ⇒ decline.

§2 Gap 6: list-only inventory — original unprefixed tool defs per server.

Pure JSON-RPC 2.0 codec for the in-house MCP client (SPEC §2).

A loaded MCP source: tools, per-server status, and its own supervisor.

Incremental server-sent-events parser: feed chunks, collect complete events. MCP-style streams (event:/data: lines, no [DONE] sentinel).

Stdio transport for a local MCP server (SPEC §2 "local").

Streamable-HTTP transport for a remote MCP server (SPEC §2 "remote"), built on Req. POSTs JSON-RPC to the configured url with the configured headers (after ${ENV_VAR} expansion — values are never logged), accepts either a JSON response or an SSE stream, carries the Mcp-Session-Id response header onto subsequent requests, and DELETEs the session on close.

MCP — INBOUND: serve a toolkit as an MCP server (SPEC §7C).

Native tools — turn a plain function into a uniform Toolnexus.Tool (SPEC §6).

A §10 suspension request. JSON keys are byte-identical across ports: {id, kind, prompt, url?, data?, expiresAt?}.

A2A (agent-to-agent) — INBOUND: serve a toolkit as a remote A2A agent (SPEC §7B), with the MCP profile co-mounted at /mcp (SPEC §7C).

File-backed store — one JSON file per Task id, under dir.

Handle returned by serve — the base URL + port plus stop/close.

Default store — Tasks live only for the lifetime of the process.

Pluggable Task persistence: get(store, id) and save(store, task).

Dynamic agent-skill source (SPEC §3). Mirrors js/src/skill.ts: discover **/SKILL.md, parse frontmatter, and expose ONE skill tool that loads a skill's instructions + sampled resources on demand (progressive disclosure).

One discovered skill (SPEC §3).

The built skill source: skills + the single skill tool + system-prompt catalog.

The uniform tool: a named, described, JSON-Schema'd callable (SPEC §1).

Uniform tool result (SPEC §1). metadata.pending carrying a Request = suspension (§10).

Toolkit — aggregates dynamic MCP tools + the skill tool + built-ins + remote A2A agents + custom tools into a single uniform list, with provider adapters and a single execute/4 router (SPEC §4).