feat(mcp): manage disposition metrics via update_agent (PRO-1949) - #31
Merged
Conversation
Add add_disposition_metrics / remove_disposition_metrics params to update_agent for post-call disposition metrics (postCallAnalyticsConfig). The backend only supports full-array replace, so this reads the branch's current metrics (draft-aware via GET /agent/:id?draftId=|versionId=), applies remove-then-add (upsert by identifier), validates locally (identifier format, ENUM needs choices, no dup ids), and writes the full array back — preserving summaryPrompt and untouched metrics. Passes expectedRevision for optimistic concurrency when a draft is already open. get_agent now lists current dispositionMetrics (read from _resolvedConfig, since the agent DTO strips postCallAnalyticsConfig). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
prat11m
requested review from
abhishekmishragithub,
harshitajain165 and
maharshi-smallest
as code owners
July 24, 2026 09:57
abhishekmishragithub
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds post-call disposition metric management to the MCP
update_agenttool. PreviouslydispositionMetrics(postCallAnalyticsConfig) was unreachable via MCP — the tool only exposed the free-formcallDispositionConfigstring.Two new params on
update_agent:add_disposition_metrics—[{ identifier, prompt, metric_type, choices? }], upsert by identifierremove_disposition_metrics—[identifier]The backend only supports full-array replace on
postCallAnalyticsConfig(no per-metric endpoint), so the tool masks that: it reads the branch's current metrics, applies remove-then-add, and writes the whole array back — preservingsummaryPromptand untouched metrics. Callers just say "+ these / − those".How
readResolvedConfiginversioning.tsusesGET /agent/:id?draftId=|versionId=— the only path that resolves section blocks into a flat config (blocks store section references, not inline content).transformPostCallAnalyticsConfig): identifier^[a-z0-9_]+$, ENUM requires non-emptychoices, no duplicate identifiers — clear errors before the round-trip.postCallAnalyticsConfigvia the existing draft PUT, withexpectedRevisionpassed for optimistic concurrency when a draft is already open (backend 409s on a conflicting analytics-section edit instead of clobbering).get_agentnow lists currentdispositionMetrics(read from_resolvedConfig, since the agent DTO stripspostCallAnalyticsConfig).Metric shape:
{ identifier, dispositionMetricPrompt, dispositionMetricType ∈ STRING|BOOLEAN|INTEGER|ENUM|DATETIME, choices? (ENUM) }.What to test
update_agentwithadd_disposition_metrics(each type; ENUM with/without choices) on a branch →get_branch_draft/test_agent --include_draftshows them.remove_disposition_metricsdrops it.get_agentlists the live metrics.expectedRevisionconflict.What to validate
summaryPromptis preserved when only metrics change.Env vars
None.
Deployment
Plain merge-deploy (rebuild + redeploy MCP server). No migrations, no config.
Notes
Related backend/PCA bugs tracked in PRO-1949 (weak
callDispositionConfigvalidation, no granular metric API,...pcapassthrough) — out of scope for this PR.🤖 Generated with Claude Code