Skip to content

Make the agent's tool list come from the tool nodes it reads, not the hardcoded fallback #3429

Closed

Description

@malibio

Overview

The local agent is meant to build its tool surface from the seeded tool nodes, so a tool node's description, parameter_schema and enabled take effect, and so a non-internal tool must be enabled before it is offered. As far as can be read from the code, available_tools() never actually uses the nodes. It reads their fields from the wrong place, skips every node, and falls back to the hardcoded list.

Problem Statement

  • Seeded tool nodes store their fields in the tool bucket: properties.tool.handler, .description, .parameter_schema, .source, .enabled. All 21 nodes in a current local database have that shape, and ToolNodeBehavior (packages/core/src/behaviors/mod.rs) reads them from the bucket (get_namespaced_prop_str(&node.properties, "tool", "handler")).
  • available_tools() (packages/agent/src/local_agent/tools.rs) queries the tool nodes, but reads each field from the top level of properties: props.get("handler"), props.get("source"), props.get("enabled"), props.get("description"), props.get("parameter_schema").
  • So handler reads as empty for every node, every node is skipped, node_defs stays empty, and the function returns model_facing_tool_definitions(), the hardcoded list.
  • Consequences:
    • Editing a tool node's description or parameter schema has no effect.
    • enabled: false does not remove a tool.
    • The trust gate for non-internal tools (source == "internal" || enabled) never runs.
  • available_tools_returns_every_model_facing_tool passes either way, because the fallback returns the same names.

Proposed Solution

  1. Write a test that seeds bucketed tool nodes with a changed description and enabled: false on one tool, and assert they take effect. This confirms the defect: the test should fail on main.
  2. Read the fields from the tool bucket, with the same helper ToolNodeBehavior uses, so reader and writer agree.
  3. Keep the fallback only for a missing node service or an empty query, and log at warn if tool nodes exist but none produced a definition, so this can't silently recur.

Acceptance Criteria

  • A test seeds bucketed tool nodes and asserts that an edited description and parameter_schema reach the returned ToolDefinition; it fails before the fix and passes after
  • A tool node with enabled: false and a non-internal source is not offered; an internal tool is offered (test)
  • When tool nodes exist but none yield a definition, a warn is logged and the fallback is used (test)
  • Prompt golden unchanged, or regenerated with the diff reviewed if seeded descriptions differ from the hardcoded ones
  • bun run test:changed passes; bun run quality:fix clean

Technical Specifications

Reference Files

  • Reader: packages/agent/src/local_agent/tools.rs (available_tools, model_facing_tool_definitions, is_system_only_tool)
  • Writer and validator: packages/core/src/behaviors/mod.rs (ToolNodeBehavior, get_namespaced_prop_str)
  • Seeds: packages/agent/src/skill_pipeline.rs (seed_tool_nodes)

Architecture Impact

ADR-038 says tools may be stored as registry nodes, and the model is presented typed tools generated from those nodes. This fix makes that true. A planned restructure turns tool into an abstract base with a tool-native subtype and drops source. This fix is independent of it and lands first.

Non-Goals

  • The tool / tool-native restructure
  • Tool semantic search
  • Remote tools

Activity

  1. malibio commented on Oct 1, 2026

    @malibio
    CollaboratorAuthor

    Frontend: 298 test files passed (5510 tests)

  2. self-assigned this
    on Oct 1, 2026
  3. added a commit that references this issue on Oct 1, 2026
    999d1fe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions