Skip to content

[API] Expose capture_pprof as an MCP tool (capture_agent_pprof) #2401

Description

@ToddHebebrand

Description

PR #2394 (#2389) adds the capture_pprof agent command (heap/goroutine profiles returned base64 via the command result, no listener). Making it AI-invokable was deliberately deferred because MCP tool registration requires a multi-site sweep, and partial registration is a known drift trap (the AI gate reads TWO maps — a tool registered in one but not the other silently misbehaves).

Proposed Fix

Register capture_agent_pprof following the set_agent_log_level pattern (apps/api/src/services/aiToolsAgentLogs.ts:150-230), covering ALL registration sites in one PR:

  • SDK tool map / registry hub
  • guardrails permission map AND rate-limit map (both — dual-map drift)
  • approval switch (approval-gated, Tier-2, like other device-touching diagnostics)
  • tool schemas
  • web tierConfig (×3 sites)

Result should surface profile metadata (sizes, capture time) and hand back the artifact in a way the chat UI can offer for download, not a giant inline base64 blob in the transcript.

Blocked On

PR #2394 — the agent command and CAPTURE_PPROF command type only exist on that branch.

Affected Files

  • apps/api/src/services/aiToolsAgentLogs.ts (or a new aiToolsDiag file per the hub/per-domain pattern)
  • guardrails + tierConfig registration sites

Refs #2389.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions