inject_context
Update AI agents with real-time context during active phone calls. Send mid-call information such as order updates or customer details to improve conversation accuracy.
Instructions
Send a message or context into an active streaming call's AI agent. Use this to give the AI agent new information mid-call (e.g. 'The customer's order #1234 has shipped').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| call_id | Yes | The call ID (must be an active streaming call) | |
| message | Yes | The context message to inject (max 2000 chars) |
Implementation Reference
- src/tools/calls.ts:132-133 (handler)The handler function that executes the inject_context tool logic. It receives params (call_id and message) and makes a POST request to /calls/{call_id}/context endpoint using the client.
async (params) => callTool(() => client.post(`/calls/${params.call_id}/context`, { message: params.message })) ); - src/tools/calls.ts:122-131 (schema)Input schema definition for inject_context tool using Zod validation. Defines call_id (string) and message (string, max 2000 chars) parameters with descriptions, plus tool annotations indicating it's not read-only, not destructive, not idempotent, and has open-world behavior.
{ description: "Send a message or context into an active streaming call's AI agent. " + "Use this to give the AI agent new information mid-call (e.g. 'The customer's order #1234 has shipped').", inputSchema: { call_id: z.string().describe("The call ID (must be an active streaming call)"), message: z.string().describe("The context message to inject (max 2000 chars)"), }, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }, }, - src/tools/calls.ts:120-133 (registration)Complete registration of the inject_context tool with the MCP server. Registers the tool name 'inject_context' along with its schema and handler function.
server.registerTool( "inject_context", { description: "Send a message or context into an active streaming call's AI agent. " + "Use this to give the AI agent new information mid-call (e.g. 'The customer's order #1234 has shipped').", inputSchema: { call_id: z.string().describe("The call ID (must be an active streaming call)"), message: z.string().describe("The context message to inject (max 2000 chars)"), }, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }, }, async (params) => callTool(() => client.post(`/calls/${params.call_id}/context`, { message: params.message })) );