search_user
Find Carbon Voice users by phone number, email, ID, or contact name to retrieve conversation details and send messages.
Instructions
Search for a User by their phone number, email address, id or name. (In order to search for a User, you must provide a phone number, email address, id or name.)When searching by name, only users that are part of your contacts will be returned
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| No | Email Address | ||
| phone | No | Phone Number | |
| name | No | The name of the user to search for (Only users that are part of your contacts will be returned) |
Implementation Reference
- src/server.ts:345-357 (handler)The inline handler function for the MCP 'search_user' tool. It calls the simplifiedApi.searchUser with the input args and authentication token, formats the response to McpToolResponse, and handles errors.async (args: SearchUserParams, { authInfo }): Promise<McpToolResponse> => { try { return formatToMCPToolResponse( await simplifiedApi.searchUser( args, setCarbonVoiceAuthHeader(authInfo?.token), ), ); } catch (error) { logger.error('Error searching for user:', { args, error }); return formatToMCPToolResponse(error); } },
- src/server.ts:332-358 (registration)Registers the 'search_user' tool with the MCP server, providing description, input schema from searchUserQueryParams, annotations, and the handler function.server.registerTool( 'search_user', { description: 'Search for a User by their phone number, email address, id or name. ' + '(In order to search for a User, you must provide a phone number, email address, id or name.)' + 'When searching by name, only users that are part of your contacts will be returned', inputSchema: searchUserQueryParams.shape, annotations: { readOnlyHint: true, destructiveHint: false, }, }, async (args: SearchUserParams, { authInfo }): Promise<McpToolResponse> => { try { return formatToMCPToolResponse( await simplifiedApi.searchUser( args, setCarbonVoiceAuthHeader(authInfo?.token), ), ); } catch (error) { logger.error('Error searching for user:', { args, error }); return formatToMCPToolResponse(error); } }, );
- Zod input schema used for validating parameters (email, phone, name) for the search_user tool.export const searchUserQueryParams = zod.object({ "email": zod.string().optional().describe('Email Address'), "phone": zod.string().optional().describe('Phone Number'), "name": zod.string().optional().describe('The name of the user to search for (Only users that are part of your contacts will be returned)') })
- Generated API client helper function that performs the actual HTTP GET request to `/simplified/users/search` endpoint to search for a user.const searchUser = ( params?: SearchUserParams, options?: SecondParameter<typeof mutator>, ) => { return mutator<User>( { url: `/simplified/users/search`, method: 'GET', params }, options, ); };
- TypeScript type definition matching the input schema for search_user parameters.export type SearchUserParams = { /** * Email Address */ email?: string; /** * Phone Number */ phone?: string; /** * The name of the user to search for (Only users that are part of your contacts will be returned) */ name?: string; };