hangup_call
Terminate active phone calls immediately using the call ID. Ends ongoing conversations in the BubblyPhone telephony system to disconnect callers.
Instructions
Terminate an active call immediately.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| call_id | Yes | The call ID to hang up |
Implementation Reference
- src/tools/calls.ts:104-104 (handler)The handler function that executes the hangup_call tool logic - makes a POST request to /calls/{call_id}/hangup endpoint
async (params) => callTool(() => client.post(`/calls/${params.call_id}/hangup`)) - src/tools/calls.ts:99-101 (schema)Input schema validation for hangup_call - requires a call_id string parameter
inputSchema: { call_id: z.string().describe("The call ID to hang up"), }, - src/tools/calls.ts:95-105 (registration)Registration of the hangup_call tool with the MCP server, including name, description, schema, annotations, and handler
server.registerTool( "hangup_call", { description: "Terminate an active call immediately.", inputSchema: { call_id: z.string().describe("The call ID to hang up"), }, annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true }, }, async (params) => callTool(() => client.post(`/calls/${params.call_id}/hangup`)) ); - src/tools/calls.ts:13-20 (helper)Helper function that wraps tool execution with error handling - catches ApiError and returns formatted error response
async function callTool<T>(fn: () => Promise<T>) { try { return toolResult(await fn()); } catch (err) { const apiErr = err as ApiError; return toolError(`API error (${apiErr.status}): ${apiErr.message}`); } } - src/client.ts:33-39 (helper)BubblyPhoneClient.post method - makes authenticated POST HTTP requests to the API
async post<T = unknown>(path: string, body?: Record<string, unknown>): Promise<T> { return this.request<T>(`${this.baseUrl}${path}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: body ? JSON.stringify(body) : undefined, }); }