Skip to content

Add the remote tool types tool-mcp, tool-rest and tool-cli (inert core types) - #4302

Merged
mstomar125 merged 4 commits into
mainfrom
issue-4291-remote-tools-core
Nov 19, 2026
Merged

mstomar125 merged 4 commits into
mainfrom
issue-4291-remote-tools-core

Conversation

@mstomar125

@mstomar125 mstomar125 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

DO NOT MERGE until the agent owner agrees. This PR includes one mechanical, behaviour-neutral line under packages/agent (one commit, agent_loop: handle the remote tool types in the type-name match): the exhaustive match on CoreNodeType in agent_loop.rs must list the three new variants or the workspace does not compile. Nothing else under packages/agent is touched.

Conflicts with the ACP type PR: that PR (#4300) has already merged; this branch is rebased onto it and resolved. The conflicts were in core_type.rs (variant list, ALL length, info(), test matches), convert.rs, core_schemas.rs (the sorted-ids test), agent_loop.rs (the same match arm), the shape record snapshot and change log, the generated TypeScript, the plugin registry test and the node-types sheet. Each is a list or a count; keep both sides.

Known limits (read before building on this)

  • local_only is not yet delivered for tool nodes. (The schema, descriptions and the sheet say only that the fields are declared local-only.) The sync service builds its local-only map from each core schema keyed by exact node_type, with only that schema's own fields and no extends chain, so enabled and approved_binding (stored in properties["tool"]) are not stripped on push or ignored on pull for tool-* nodes. The classification is declared in the schema, nothing more, until the sync fix lands (sync issue: nodespace-sync#1047; the real-core-type test is sync Prompt node type with PromptAssembler service and graph-override layering #1049). The agent-lane gate must not rely on it until then.
  • Merge order for the sync guarantee: core Add the remote tool types tool-mcp, tool-rest and tool-cli (inert core types) #4302, then the sync core-pin bump, then sync Prompt node type with PromptAssembler service and graph-override layering #1049's real-core-type test.
  • A tool that arrives from a peer through a path that applies no defaults has enabled ABSENT (sync drops the foreign value), not false. Absent means off: the schema description and the sheet say so, and tests (an_absent_enabled_means_off, an_absent_enabled_is_a_draft) assert an absent enabled is treated as disabled by the behaviours and the offering rule.
  • approved_binding is only a field here: nothing compares or writes it yet. A description edit after approval does not change the fingerprint, by design (the text the model reads is outside the hash).
  • The closed-root rule does not constrain nested allOf, patternProperties or $ref: a residual risk for the agent-lane executor or validator.
  • A secret is checked as a name only; a token-shaped name passes. An interpreter program (sh, env) passes: the confirmation and the fingerprint are the guards, and an executor must insert -- before model-supplied values and percent-encode placeholder values.
  • Existing databases are refused. tool gains a core field (approved_binding), so a database created by 0.3.11 or by main today holds a tool schema without it: the core-type comparison reports a missing field (schema mismatch) and the database is refused at open until reset. Accepted: no users, no compatibility code.

Refs #4291. Inert core types for remote tools: no execution, no offering code, no credential store.

Classification

  • Kind: core_subtype (three of them, each extends the abstract base tool)
  • Category: structured (inherited object-valued parameter_schema)
  • Wire shape: Generic; fields stay in properties. Structure none/any, embedded as name and description only.

What is added

Registry (nodespace-types): ToolMcp, ToolRest, ToolCli (tool-mcp, tool-rest, tool-cli).

Seeded schemas (core_schemas.rs), all snake_case, closed, schema defaults the only defaults:

  • tool-mcp: transport (enum stdio, http), command, args, url, remote_tool_name, env ({name, secret}[]), auth ({scheme: none|bearer|header, header_name, secret}), timeout_seconds (default 30).
  • tool-rest: method (enum GET..DELETE), url_template, query_params, body (enum none, json; default none), headers ({name, value}[]), auth (scheme also basic), timeout_seconds (30), max_response_bytes (1048576).
  • tool-cli: program, args, env, timeout_seconds (30), max_output_bytes (1048576).
  • tool base: enabled becomes local_only; new approved_binding (local_only, optional text: the fingerprint written when a tool is enabled on this device).

Readers (nodespace-types/src/tool_binding.rs): ToolMcpFields, ToolRestFields, ToolCliFields, CredentialRef (keychain:<name> / env:<NAME>, never a value), is_tool_name, check_closed_root, and the limits (300 s, 10 MiB maxima; 30 s, 1 MiB defaults). They are serde types, so the generator also emits TypeScript for the six binding structs; the tool family's wire shape stays generic.

Binding fingerprint (behaviors::tool_binding_hash, in core, which already has sha2): SHA-256 over every non-tool bucket of the chain plus parameter_schema, canonical key order. Name, description, enabled, approved_binding are outside it. Nothing compares it yet; the offering gate is agent-lane work.

Behaviours (ToolMcpNodeBehavior, ToolRestNodeBehavior, ToolCliNodeBehavior, registered after ToolNodeBehavior): name is [A-Za-z][A-Za-z0-9_-]{0,63}; parameter_schema, when set, has a closed root (type: "object", additionalProperties: false; the base rule is unchanged); every set binding field is well formed; enabled: true requires a complete binding (required fields, every {placeholder} and query name a property of parameter_schema); URLs are https (http only for a loopback host, no embedded credentials); the URL template must start with a literal http:///https:// and its scheme, host and port must be identical when every placeholder is filled with x and with y (so https:{h}/p, https:/{h}/p, https:///{a} and a backslash are refused); argv items are literals or one whole {name}; a secret must be a well-formed reference; approved_binding is a fingerprint or unset. Embedding is the base's (name and description).

Shape record

bun run shape:gen regenerated current.json. Change-log entries (class chosen from core_type_shape.rs, which compares fields and reads neither local_only nor relationships):

  • remote-tool-types-added: additive (a core type the database lacks is seeded).
  • tool-approved-binding-field: refuse (an older tool schema lacks a core field; the database is refused at open until reset).
  • tool-enabled-kept-on-device: migrate (the stored tool.enabled keeps local_only: false; the comparison does not read the flag, but the database is refused at open anyway for the missing field, so a reset is the fix). The reference page's stale class does not exist in the code's enum, so migrate is the closest.

The refuse and migrate entries need a release-time decision (accepted_reset_required); not added here.

Docs

Sheet and tool registry page: nodespace-docs #163 (rebased onto the ACP sheet change) (separate PR; the gate reads the docs main once, so it lands just before this one is queued).

Tests

  • nodespace-types: 233 pass (new: reader and reference rules, registry subtype test).
  • nodespace-core unit: behaviours, binding hash, schemas, embedding list.
  • tool_subtypes_test.rs (through the node service): subtypes returned by a query for tool; binding stored in own bucket with defaults; undeclared keys refused; invalid bindings refused naming the rule; incomplete enable refused, draft allowed; literal credential refused at create and update; closed root; name rule; embedded text is name and description only; a user subtype of tool-rest keeps the rules; retyping applies the new kind's rules; trust fields local_only; approved_binding form.
  • bun run test:changed passes (rerun after review fixes) (frontend, scripts, Chromium, types, shape, node-types, Rust workspace). Frontend: plugin registry, node types and schema authoring lists. bun run types:check, shape:check, node-types:check pass.
  • Each new test was mutation-checked (about 20 mutants of the rules, schemas and registry); two survivors found and covered by new assertions.

Verified differently from the spec

  • Hash lives in core, not nodespace-types (that crate has no hash dependency).
  • seed-updates.svelte.ts is not changed: the remote kinds are user-created, not seeded, so no review-screen label is needed.
  • The "+New" flow seeds a hyphenated placeholder name (untitled-tool-cli) for the remote kinds so it passes the name rule.

🤖 Generated with Claude Code

Deny-lists as they now stand

  • Env names refused: prefixes LD_, DYLD_, GIT_, PYTHON, NODE_, JAVA, BASH_FUNC_, any *_PROXY, and PATH, HOME, TMPDIR, IFS, SHELL*, BASHOPTS, PS4, PROMPT_COMMAND, SSL/CA variables and similar (case-insensitive). A deny-list: GITHUB_TOKEN stays allowed (tested).
  • Reserved headers also include Keep-Alive and Forwarded; a program may not start with // or \\ (UNC).
  • Schema descriptions say the trust fields are declared local-only.

For the executor PR

  • Re-read the URL from the parsed Url, not the template string: the url crate strips tab and newline from input.
  • A placeholder value of .. (or any path segment value) must be rejected or percent-encoded by the executor; encode every value placed in a placeholder.
  • The reader sets no length caps on strings and lists beyond a few fixed limits: the executor should bound argument counts and sizes.
  • Put -- before any model-supplied argv value; an interpreter program (sh, env) is accepted by design, with the confirmation and the fingerprint as guards.
  • Invalid bindings are refused on create_node, bulk_create, bulk_create_hierarchy, bulk_create_hierarchy_trusted and bulk_update (tested).

mstomar125 and others added 4 commits November 19, 2026 06:59
Three core subtypes of tool, inert: registry entries, seeded schemas with their
binding fields, binding readers and a credential-reference parser in
nodespace-types, behaviours that validate the binding (closed parameter_schema
root, https URLs, no templated host, whole-element argv placeholders, complete
binding before enabled), and a binding fingerprint in core. tool.enabled
becomes local_only and tool gains a local_only approved_binding field. Shape
record, change log and generated TypeScript follow.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…t-owner sign-off needed)

The exhaustive match on CoreNodeType lists the three new variants with the
other types that have no plain-language names.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
URL templates are parsed with every placeholder filled two ways and must keep
one scheme, host and port, behind a literal http(s):// prefix with no
backslash. A program is a bare name or an absolute path without .., headers
share one reserved list, env names that change loading are refused, and a
remote tool placeholder name is hyphenated in the +New flow. Descriptions,
change-log entries and tests say only what the fields are and that an absent
enabled means off.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Env names under the GIT_, PYTHON, NODE_, JAVA and BASH_FUNC_ prefixes, any
*_PROXY name, and HOME, TMPDIR, shell option and certificate variables are
refused, while ordinary names such as GITHUB_TOKEN stay allowed. Keep-Alive and
Forwarded join the reserved headers, and a program may not start with // or two
backslashes. The enabled and approved_binding descriptions say they are
declared local-only. Tests hold an invalid binding on every batch write path.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@mstomar125
mstomar125 force-pushed the issue-4291-remote-tools-core branch from e2a588e to 8ba5fb2 Compare November 19, 2026 05:59
@mstomar125
mstomar125 merged commit 3e732a9 into main Nov 19, 2026
@mstomar125
mstomar125 deleted the issue-4291-remote-tools-core branch November 19, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant