UAT: agents tool add --format json outputs raw tool dict fields instead of spec-required data.tool_registered + data.capability nested structure #6862

Open
opened 2026-04-10 03:43:07 +00:00 by HAL9000 · 0 comments
Owner

Background and Context

The spec (§ "agents tool add") defines that --format json output must include data.tool_registered (with name, description, source, config, created fields) and a separate data.capability object. Code analysis of src/cleveragents/cli/commands/tool.py shows the implementation passes the raw domain model dict through _print_tool() which does not produce the spec-required schema.

Current Behavior

agents tool add --format json (lines 266–267 of tool.py):

registered = service.register_tool(tool)
_print_tool(registered, title="Tool Registered", fmt=fmt)

_print_tool() with non-rich format (lines 143–147):

def _print_tool(tool, title="Tool", fmt=OutputFormat.RICH.value):
    if fmt != OutputFormat.RICH.value:
        data = _tool_spec_dict(tool)
        console.print(format_output(dict(data), fmt))
        return

_tool_spec_dict() returns a flat dict like:

{
  "name": "local/run-migrations",
  "description": "Run database migrations",
  "source": "custom",
  "tool_type": "tool",
  "namespace": "local",
  "short_name": "run-migrations",
  "capability": { "read_only": false, "writes": true, "checkpointable": true },
  "timeout": 300
}

This is a flat dict with capability inline (not under data.capability) and missing config and created fields. The entire dict is also not nested under data.tool_registered.

Expected Behavior

Per spec, agents tool add --config ./tools/run-migrations.yaml --format json must produce:

{
  "command": "tool add",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "tool_registered": {
      "name": "local/run-migrations",
      "description": "Run database migrations",
      "source": "custom",
      "config": "./tools/run-migrations.yaml",
      "created": "2026-02-09T10:15:00Z"
    },
    "capability": {
      "writes": true,
      "write_scope": "database:migrations",
      "checkpointable": true,
      "checkpoint_scope": "transaction",
      "side_effects": ["schema_mutation"]
    }
  },
  "timing": { "duration_ms": 58 },
  "messages": ["Tool registered"]
}

For --update case, the spec uses data.tool_updated (not data.tool_registered) with status, previous_version, current_version, changes, and references fields.

Acceptance Criteria

  • agents tool add (new registration): output nested under data.tool_registered with name, description, source, config, created fields; data.capability separate
  • agents tool add --update (update): output nested under data.tool_updated with name, source, status, previous_version, current_version; plus data.changes and data.references
  • config field sourced from the --config path passed to the command
  • created timestamp included in tool_registered
  • Add Behave scenario verifying tool add JSON schema
  • Run nox (all default sessions), fix any errors

Supporting Information

  • Spec: docs/specification.md § "agents tool add" (JSON tab examples, lines ~7610–7634 and ~7775–7802)
  • Code: src/cleveragents/cli/commands/tool.py lines 143–147, 238–267

Subtasks

  • Update add command to pass config path and registration timestamp into JSON output
  • Build data.tool_registered nested dict with spec fields
  • Build data.capability from tool's capability model
  • Handle --update case separately with data.tool_updated + data.changes + data.references
  • Tests (Behave): add scenarios for both tool add (new) and tool add --update JSON schemas
  • Run nox, fix all errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit with Conventional Changelog format first line.
  • Pushed to remote on appropriate branch and submitted as PR to master.

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Background and Context The spec (§ "agents tool add") defines that `--format json` output must include `data.tool_registered` (with `name`, `description`, `source`, `config`, `created` fields) and a separate `data.capability` object. Code analysis of `src/cleveragents/cli/commands/tool.py` shows the implementation passes the raw domain model dict through `_print_tool()` which does not produce the spec-required schema. ## Current Behavior `agents tool add --format json` (lines 266–267 of `tool.py`): ```python registered = service.register_tool(tool) _print_tool(registered, title="Tool Registered", fmt=fmt) ``` `_print_tool()` with non-rich format (lines 143–147): ```python def _print_tool(tool, title="Tool", fmt=OutputFormat.RICH.value): if fmt != OutputFormat.RICH.value: data = _tool_spec_dict(tool) console.print(format_output(dict(data), fmt)) return ``` `_tool_spec_dict()` returns a flat dict like: ```json { "name": "local/run-migrations", "description": "Run database migrations", "source": "custom", "tool_type": "tool", "namespace": "local", "short_name": "run-migrations", "capability": { "read_only": false, "writes": true, "checkpointable": true }, "timeout": 300 } ``` This is a flat dict with `capability` inline (not under `data.capability`) and missing `config` and `created` fields. The entire dict is also not nested under `data.tool_registered`. ## Expected Behavior Per spec, `agents tool add --config ./tools/run-migrations.yaml --format json` must produce: ```json { "command": "tool add", "status": "ok", "exit_code": 0, "data": { "tool_registered": { "name": "local/run-migrations", "description": "Run database migrations", "source": "custom", "config": "./tools/run-migrations.yaml", "created": "2026-02-09T10:15:00Z" }, "capability": { "writes": true, "write_scope": "database:migrations", "checkpointable": true, "checkpoint_scope": "transaction", "side_effects": ["schema_mutation"] } }, "timing": { "duration_ms": 58 }, "messages": ["Tool registered"] } ``` For `--update` case, the spec uses `data.tool_updated` (not `data.tool_registered`) with `status`, `previous_version`, `current_version`, `changes`, and `references` fields. ## Acceptance Criteria - [ ] `agents tool add` (new registration): output nested under `data.tool_registered` with `name`, `description`, `source`, `config`, `created` fields; `data.capability` separate - [ ] `agents tool add --update` (update): output nested under `data.tool_updated` with `name`, `source`, `status`, `previous_version`, `current_version`; plus `data.changes` and `data.references` - [ ] `config` field sourced from the `--config` path passed to the command - [ ] `created` timestamp included in tool_registered - [ ] Add Behave scenario verifying `tool add` JSON schema - [ ] Run `nox` (all default sessions), fix any errors ## Supporting Information - Spec: `docs/specification.md` § "agents tool add" (JSON tab examples, lines ~7610–7634 and ~7775–7802) - Code: `src/cleveragents/cli/commands/tool.py` lines 143–147, 238–267 ## Subtasks - [ ] Update `add` command to pass config path and registration timestamp into JSON output - [ ] Build `data.tool_registered` nested dict with spec fields - [ ] Build `data.capability` from tool's capability model - [ ] Handle `--update` case separately with `data.tool_updated` + `data.changes` + `data.references` - [ ] Tests (Behave): add scenarios for both `tool add` (new) and `tool add --update` JSON schemas - [ ] Run `nox`, fix all errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit with Conventional Changelog format first line. - Pushed to remote on appropriate branch and submitted as PR to `master`. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.4.0 milestone 2026-04-10 04:39:49 +00:00
HAL9000 self-assigned this 2026-04-10 06:06:35 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#6862
No description provided.