Skip to content

feat: add config_view and list_tools introspection tools - #177

Merged
jkyberneees merged 1 commit into
mainfrom
feat/config-introspection-tools
Sep 3, 2026
Merged

feat: add config_view and list_tools introspection tools#177
jkyberneees merged 1 commit into
mainfrom
feat/config-introspection-tools

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Summary

Gives the agent read access to its own resolved configuration — closing a real introspection gap: the agent could discover capability profiles (list_subagent_profiles) but not the effective security posture, sub-agent budgets, or execution limits it operates under.

New tools

  • config_view — sanitized resolved config (post five-layer merge), section-filterable: all | core | security | subagent | limits | memory | skills | background | maintenance. Secrets (api_key, base_url, env values) are structurally excluded — whitelist builders, no render-time filtering.
  • list_tools — the live tool registry for this run (captured after all conditional registrations), enabled/disabled filter state, and MCP server posture with credential argv redacted (defense in depth: REST keeps verbatim argv behind CSRF; the model face redacts --api-key-style values).

Design

  • One sanitizer, two consumers: buildConfigView/buildLimitsView/buildMCPServersView are shared by the REST management API (/api/config, /api/limits, /api/mcp, /api/tools) and the tools. REST↔tool parity is pinned by TestRESTConfigViewMatchesToolAll + TestRESTLimitsMatchesSharedBuilder.
  • /api/config gains additive subagent/background/limits keys (same builder).
  • Tool structs never hold config.ResolvedConfig — only pre-built views via toolConfig.Introspection.
  • Both tools are safe-class: read-only, no approver, auto-available to sub-agents (children rerun builtinTools with their own resolved config).

Adversarial review

Reviewed by a sub-agent before this PR (per release gate). Findings fixed:

  • P1: list_tools live-registry capture was silently missing → empty listings in production. Fixed + wiring test through the real builtinTools path.
  • P2: MCP argv (which can carry --api-key …) reached model context ungated. Fixed: credential-flag argv redaction on the tool face only, pinned by TestMCPServerArgsRedactedOnToolFace incl. a wiring-path assertion.
  • P3: /api/tools now applies the shared toolEnabled rule; stale trust_level=untracked note corrected.

Tests

RED-first: 11 new tests (sections, secret-leak pins, REST↔tool parity ×2, argv redaction, live-registry wiring, nil-view tolerance, reservation against MCP shadowing). go vet clean; full cmd/odek suite green (75 s, -count=1); -race clean on the new tests.

Docs

AGENTS.md tool list, docs/TOOL_SELECTION.md, docs/CHEATSHEET.md, docs/MCP.md (reserved names), docs/WEBUI.md (/api/config shape) — same commit.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
odek 679471a Commit Preview URL

Branch Preview URL
Sep 03 2026, 05:38 AM

@jkyberneees
jkyberneees merged commit cac0da7 into main Sep 3, 2026
10 checks passed
@jkyberneees
jkyberneees deleted the feat/config-introspection-tools branch September 3, 2026 05:44
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