Skip to content

feat: add get_call_details tool#17

Open
nickrobin wants to merge 1 commit into
mainfrom
add-get-call-details
Open

feat: add get_call_details tool#17
nickrobin wants to merge 1 commit into
mainfrom
add-get-call-details

Conversation

@nickrobin
Copy link
Copy Markdown

Summary

The existing get_call tool returns a summary projection (id, status, endedReason, assistantId, phoneNumberId, customer.number, scheduledAt) — there's no way to fetch transcripts, recordings, messages, costs, or analysis through MCP without dropping out to the REST API.

This adds a sibling get_call_details tool that returns the full call payload. It accepts an optional include array so callers can scope the response to specific fields and keep LLM context windows manageable on long calls.

Changes

  • New schemas in src/schemas/index.ts:
    • GetCallDetailsInputSchema (callId + optional include)
    • CallDetailsOutputSchema (extends CallOutputSchema)
    • CALL_DETAIL_FIELDS constant
  • New transformer transformCallDetailsOutput in src/transformers/index.ts — falls back to call.artifact[field] when the field isn't on the top-level call object
  • New tool registration get_call_details in src/tools/call.ts, paired with the existing get_call
  • E2E test updated to assert the tool is registered

Test plan

  • npm run build passes
  • tsc --noEmit clean
  • Manually verify against a real call ID via the MCP inspector
  • include: ['transcript'] returns just { id, transcript }
  • No include returns the full summary + all detail fields

The existing get_call tool returns a summary projection (id, status,
endedReason, assistantId, phoneNumberId, customer.number, scheduledAt)
which makes it impossible to fetch transcripts, recordings, messages,
costs, or analysis without dropping out to the REST API.

This adds a sibling get_call_details tool that returns the full call
payload. It accepts an optional 'include' array so callers can scope
the response to specific fields (transcript, recordingUrl, messages,
costs, cost, analysis, summary, artifact) and keep LLM context windows
in check on long calls.

- New schemas: GetCallDetailsInputSchema, CallDetailsOutputSchema, CALL_DETAIL_FIELDS
- New transformer: transformCallDetailsOutput
- New tool registration in src/tools/call.ts
- E2E test updated to assert tool is registered
@nickrobin nickrobin requested review from ramsrib and stevenbdf May 7, 2026 23:24
@selena-vapi
Copy link
Copy Markdown

Bumping on the review here :)

Copy link
Copy Markdown
Collaborator

@ramsrib ramsrib left a comment

Choose a reason for hiding this comment

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

Just noting that call data like transcripts + messages can easily consume 200k+ tokens in real-world use cases.

I would be careful when adding fields like artifacts, messages or costs. Keep it as minimal as possible.

Messages and transcripts are mostly duplicate data, and artifacts contain a lot of duplicates as well.

Comment thread src/transformers/index.ts
include?: ReadonlyArray<(typeof CALL_DETAIL_FIELDS)[number]>
): Record<string, unknown> {
const summary = transformCallOutput(call);
const callRecord = call as unknown as Record<string, unknown>;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

we should avoid casting 'as unknown as Record...' not a blocker but something to flag for cleanup

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.

5 participants