get_my_profile
Retrieve your user profile details from the EventHorizon platform to access personal information and manage your account settings.
Instructions
Get the current user's profile information.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_my_profile"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:306-334 (handler)MCP tool registration and inline handler for 'get_my_profile'. Fetches the current user's profile using EventHorizonClient and formats it as a text response.
server.tool( 'get_my_profile', 'Get the current user\'s profile information.', {}, async () => { try { const apiClient = getClient(); const profile = await apiClient.getCurrentProfile(); return { content: [{ type: 'text', text: `User Profile: Username: ${profile.username} Email: ${profile.email} Name: ${profile.first_name} ${profile.last_name} Bio: ${profile.profile.bio || 'Not set'} Location: ${profile.profile.location || 'Not set'} Phone: ${profile.profile.phone_number || 'Not set'} Joined: ${profile.date_joined}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); - src/api-client.ts:192-199 (helper)EventHorizonClient method that performs the actual API call to retrieve the current user's profile from '/accounts/api/me/'.
async getCurrentProfile(): Promise<User & { profile: Profile }> { try { const response: AxiosResponse<User & { profile: Profile }> = await this.client.get('/accounts/api/me/'); return response.data; } catch (error) { throw new Error(`Failed to get user profile: ${getErrorMessage(error)}`); } } - src/api-client.ts:5-26 (schema)TypeScript interfaces defining the structure of User and Profile data used by the get_my_profile tool.
export interface User { id: number; username: string; email: string; first_name: string; last_name: string; date_joined: string; } export interface Profile { bio: string; location: string; phone_number: string; avatar: string; social_links: SocialLink[]; } export interface SocialLink { platform: 'github' | 'twitter' | 'linkedin' | 'instagram' | 'facebook' | 'website' | 'other'; url: string; } - src/index.ts:17-26 (helper)Lazy-initializes and returns the EventHorizonClient instance used by all tools, including get_my_profile.
function getClient(): EventHorizonClient { if (!client) { const errors = validateConfig(); if (errors.length > 0) { throw new Error(`Configuration errors: ${errors.join('; ')}`); } client = new EventHorizonClient(); } return client; }