search_place_by_number
Find business names and addresses using phone numbers in E.164 format to identify locations through telephony data.
Instructions
Find place name and address by phone number
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| number | Yes | Phone number in E.164 format. Ex: +1234567890 |
Implementation Reference
- src/index.ts:457-481 (handler)Handler implementation for the 'search_place_by_number' tool. Extracts the phone number from the request arguments and performs a GET request to the Voyp API endpoint constructed as API_CONFIG.ENDPOINTS.PLACE_NUMBER + number (i.e., 'place/' + number). Returns the JSON-stringified response data or an error message if the API call fails.
} else if (request.params.name === "search_place_by_number") { const number = request.params.arguments?.number; try { const response = await this.axiosInstance.get<StartCallResponse>(API_CONFIG.ENDPOINTS.PLACE_NUMBER + number); 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:275-288 (schema)Schema definition for the 'search_place_by_number' tool, provided in the ListTools response. Specifies the tool name, description, and input schema requiring a single 'number' string parameter in E.164 format.
{ name: "search_place_by_number", description: "Find place name and address by phone number", inputSchema: { type: "object", properties: { number: { type: "string", description: "Phone number in E.164 format. Ex: +1234567890" } }, required: ["number"] } }, - src/index.ts:316-536 (registration)The CallToolRequestHandler registration includes the dispatch logic (if-else chain) that routes to the specific handler for 'search_place_by_number' based on request.params.name.
this.server.setRequestHandler( CallToolRequestSchema, async (request) => { 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; } } else if (request.params.name === "start_call") { // if (!isValidForecastArgs(request.params.arguments)) { // throw new McpError( // ErrorCode.InvalidParams, // "Invalid forecast arguments" // ); // } const number = request.params.arguments?.number; const context = request.params.arguments?.context; const language = request.params.arguments?.language; try { const response = await this.axiosInstance.post<StartCallResponse>(API_CONFIG.ENDPOINTS.START, { number, context, language }); 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; } } else if (request.params.name === "search_places") { // if (!isValidForecastArgs(request.params.arguments)) { // throw new McpError( // ErrorCode.InvalidParams, // "Invalid forecast arguments" // ); // } const search = request.params.arguments?.search; try { const response = await this.axiosInstance.post<StartCallResponse>(API_CONFIG.ENDPOINTS.PLACES, { search }); 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; } } else if (request.params.name === "search_place") { // if (!isValidForecastArgs(request.params.arguments)) { // throw new McpError( // ErrorCode.InvalidParams, // "Invalid forecast arguments" // ); // } const place = request.params.arguments?.place; const location = request.params.arguments?.location; try { const response = await this.axiosInstance.post<StartCallResponse>(API_CONFIG.ENDPOINTS.PLACE, { place, location }); 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; } } else if (request.params.name === "search_place_by_number") { const number = request.params.arguments?.number; try { const response = await this.axiosInstance.get<StartCallResponse>(API_CONFIG.ENDPOINTS.PLACE_NUMBER + number); 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; } } else if (request.params.name === "get_user") { try { const response = await this.axiosInstance.get<StartCallResponse>(API_CONFIG.ENDPOINTS.USER); 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; } } else if (request.params.name === "get_call") { const id = request.params.arguments?.id; try { const response = await this.axiosInstance.get<StartCallResponse>(API_CONFIG.ENDPOINTS.CALL + 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; } } else { throw new McpError( ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}` ); } } ); - src/index.ts:37-37 (helper)API endpoint configuration used by the handler: API_CONFIG.ENDPOINTS.PLACE_NUMBER = 'place/', which is concatenated with the phone number to form the full URL.
PLACE_NUMBER: 'place/'