Skip to content

feat: add tool registry for CC tool introspection#940

Merged
OneStepAt4time merged 1 commit intomainfrom
feat/704-tool-registry
Apr 3, 2026
Merged

feat: add tool registry for CC tool introspection#940
OneStepAt4time merged 1 commit intomainfrom
feat/704-tool-registry

Conversation

@OneStepAt4time
Copy link
Copy Markdown
Owner

Summary

Adds tool usage tracking and registry endpoints for CC tool introspection and analytics.

Changes

  • src/tool-registry.ts: New module with ToolRegistry class
    • Tracks per-session tool usage (count, errors, timestamps)
    • Built-in definitions for 16 CC tools (Read, Write, Edit, Bash, etc.)
    • Categories: read, write, edit, bash, search, agent, mcp
  • src/server.ts: Two new endpoints
    • GET /v1/sessions/:id/tools — tool usage for a session (parsed from JSONL on-demand)
    • GET /v1/tools — all known CC tool definitions with categories
    • Cleanup on session kill

Testing

  • tsc --noEmit ✅

Fixes #704

Copy link
Copy Markdown
Contributor

@aegis-gh-agent aegis-gh-agent bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tool registry is a reasonable MVP for CC tool introspection. One concern:

processEntries() double-counts on re-read: The endpoint /v1/sessions/:id/tools calls readNewEntries(path, 0) which re-reads ALL entries from offset 0 every time. If processEntries is called twice, it will double-count all tool uses. Consider tracking lastProcessedOffset per session, or deduplicating by entry index/timestamp.

Otherwise: cleanup on session kill is correct, tool definitions are sensible, endpoint structure is clean. Approved with note above — please address the double-count before merging or accept the limitation as documented.

@aegis-gh-agent
Copy link
Copy Markdown
Contributor

aegis-gh-agent bot commented Apr 3, 2026

Self-rebase failed — conflicts with #937, #942, #944, #945 across server.ts, session.ts, hook-settings.ts, dashboard files. Please rebase onto current main and resolve. I have approved this PR — it will merge as soon as CI passes.

Adds tool usage tracking and registry endpoints:

- GET /v1/sessions/:id/tools — list tools used in a session with usage counts,
  error counts, and timestamps
- GET /v1/tools — list all known CC tool definitions with categories

Tool definitions include name, category (read/write/edit/bash/search/agent/mcp),
description, and permission level. Session tool usage is parsed from JSONL
transcripts on-demand.

Fixes #704
@OneStepAt4time OneStepAt4time force-pushed the feat/704-tool-registry branch from ca6185a to f5b31b8 Compare April 3, 2026 07:36
@OneStepAt4time OneStepAt4time merged commit a038ad8 into main Apr 3, 2026
5 checks passed
@OneStepAt4time OneStepAt4time deleted the feat/704-tool-registry branch April 3, 2026 07:50
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.

[Enhancement] Tool registry and schema validation for CC tool introspection

1 participant