Skip to main content
Glama
sinch
by sinch
get-call-information.ts1.26 kB
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { z } from 'zod'; import { getToolName, shouldRegisterTool, VoiceToolKey } from './utils/voice-tools-helper'; import { IPromptResponse, PromptResponse, Tags } from '../../types'; import { getVoiceClient } from './utils/voice-service-helper'; import { isPromptResponse } from '../../utils'; const TOOL_KEY: VoiceToolKey = 'getCallInformation'; const TOOL_NAME = getToolName(TOOL_KEY); export const registerGetCallInformation = (server: McpServer, tags: Tags[]) => { if (!shouldRegisterTool(TOOL_KEY, tags)) return; server.tool( TOOL_NAME, 'Get information about a call using its ID', { callId: z.string().describe('The call ID to get information about') }, getCallInformationHandler ); }; export const getCallInformationHandler = async ({ callId }: { callId: string }): Promise<IPromptResponse> => { const maybeClient = getVoiceClient(TOOL_NAME); if (isPromptResponse(maybeClient)) { return maybeClient.promptResponse; } const voiceService = maybeClient.voice; const response = await voiceService.calls.get({ callId }); return new PromptResponse(`Call information for call ID ${callId}: ${JSON.stringify(response)}`).promptResponse; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sinch/sinch-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server