get_user
Retrieve user information from Carbon Voice by providing a user ID to access conversation data and contact details.
Instructions
Get a User by their ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/server.ts:307-330 (handler)Registration and inline handler function for the 'get_user' MCP tool. It takes a user ID, authenticates with a token, calls the Carbon Voice API's getUserById, and formats the response as McpToolResponse.server.registerTool( 'get_user', { description: 'Get a User by their ID.', inputSchema: getUserByIdParams.shape, annotations: { readOnlyHint: true, destructiveHint: false, }, }, async (args: GetByIdParams, { authInfo }): Promise<McpToolResponse> => { try { return formatToMCPToolResponse( await simplifiedApi.getUserById( args.id, setCarbonVoiceAuthHeader(authInfo?.token), ), ); } catch (error) { logger.error('Error getting user by id:', { args, error }); return formatToMCPToolResponse(error); } }, );
- Zod input schema for getUserByIdParams used by the 'get_user' tool, requiring a string 'id'.export const getUserByIdParams = zod.object({ "id": zod.string() })
- Generated API client method getUserById that performs the HTTP GET request to retrieve user data by ID from the Carbon Voice API.const getUserById = ( id: string, options?: SecondParameter<typeof mutator>, ) => { return mutator<User>( { url: `/simplified/users/${id}`, method: 'GET' }, options, ); };
- Zod response schema defining the structure of the User object returned by getUserById.export const getUserByIdResponse = zod.object({ "id": zod.string().describe(' ID'), "link": zod.string().describe('Link to User'), "created_at": zod.string().datetime({}), "first_name": zod.string().describe('First Name'), "last_name": zod.string().optional().describe('Last Name'), "full_name": zod.string().describe('Full Name'), "image_url": zod.string().optional().describe('Image Url'), "emails": zod.array(zod.string()).optional().describe('List of emails (First one is the primary)'), "phones": zod.array(zod.string()).optional().describe('List of phones (First one is the primary)'), "languages": zod.array(zod.string()).optional().describe('List of languages (First one is the primary)') })