hangup_call
Terminate an ongoing call by providing its unique ID to end telephony sessions through the Voyp MCP Server's integration capabilities.
Instructions
Hangup an existing call
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"id": "<id>"
},
"name": "hangup_call"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the call |
Implementation Reference
- src/index.ts:319-348 (handler)Handler for the 'hangup_call' tool within the CallToolRequestSchema request handler. Validates the 'id' parameter, performs a POST request to the Voyp API hangup endpoint, and returns the response or handles errors.
if (request.params.name === "hangup_call") { if (typeof (request.params.arguments?.id) !== 'string') { throw new McpError( ErrorCode.InvalidParams, "Invalid hangup arguments" ); } const id : string = request.params.arguments?.id as string; try { const response = await this.axiosInstance.post<HangupCallResponse>(API_CONFIG.ENDPOINTS.HANGUP, { id: id}); return { content: [{ type: "text", text: JSON.stringify(response.data) }] }; } catch (error) { if (axios.isAxiosError(error)) { return { content: [{ type: "text", text: `Voyp API error: ${error.response?.data.message ?? error.message}` }], isError: true, } } throw error; } - src/index.ts:229-242 (registration)Registration of the 'hangup_call' tool in the ListToolsRequestSchema handler, defining its name, description, and input schema.
{ name: "hangup_call", description: "Hangup an existing call", inputSchema: { type: "object", properties: { id: { type: "string", description: "ID of the call" } }, required: ["id"] } }, - src/types.ts:6-9 (schema)TypeScript interface defining the response structure for the 'hangup_call' tool API call.
export interface HangupCallResponse { success?: boolean; error?: string }