get_profile
Retrieve user profile details by providing a UID or username. If omitted, the tool defaults to the MONKEYTYPE_USERNAME environment variable, simplifying data access for authorized users.
Instructions
Get user's profile information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uidOrName | No | The UID or username of the user. If omitted or set to a keyword like 'me', 'self', 'current', or 'my', the value from the MONKEYTYPE_USERNAME environment variable will be used. |
Implementation Reference
- server.js:328-358 (handler)The handler logic for the 'get_profile' tool. Determines the target user (using MONKEYTYPE_USERNAME env var if uidOrName is omitted or a keyword like 'me'), calls the MonkeyType API endpoint /users/{uidOrName}/profile, and returns the JSON response.case "get_profile": { let targetUidOrName; const keywordsForCurrentUser = ["me", "self", "current", "my"]; if (args.uidOrName) { if (keywordsForCurrentUser.includes(args.uidOrName.toLowerCase())) { targetUidOrName = process.env.MONKEYTYPE_USERNAME; if (!targetUidOrName) { throw new Error('uidOrName specified as current user, but MONKEYTYPE_USERNAME environment variable is not set.'); } } else { targetUidOrName = args.uidOrName; // Use the explicitly provided uidOrName } } else { // No uidOrName argument provided, try to use the environment variable targetUidOrName = process.env.MONKEYTYPE_USERNAME; if (!targetUidOrName) { throw new Error('uidOrName parameter is required, or MONKEYTYPE_USERNAME environment variable must be set.'); } } // Final check to ensure targetUidOrName is a non-empty string if (!targetUidOrName || typeof targetUidOrName !== 'string' || targetUidOrName.trim() === '') { throw new Error('Could not determine a valid UID/username. Please provide the uidOrName parameter or set the MONKEYTYPE_USERNAME environment variable with a non-empty value.'); } const result = await callMonkeyTypeApi(`/users/${targetUidOrName}/profile`, 'GET', apiKey, {}); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }
- server.js:33-35 (schema)Zod input schema for the 'get_profile' tool defining the optional uidOrName parameter.const GetProfileSchema = BaseApiSchema.extend({ uidOrName: z.string().optional().describe("The UID or username of the user. If omitted or set to a keyword like 'me', 'self', 'current', or 'my', the value from the MONKEYTYPE_USERNAME environment variable will be used.") });
- server.js:183-187 (registration)Registration of the 'get_profile' tool in the ListTools response, including name, description, and input schema.{ name: "get_profile", description: "Get user's profile information", inputSchema: zodToJsonSchema(GetProfileSchema), },