upload_user_profile_image
Upload a user profile image by providing the user ID and base64 encoded image data to update their account picture.
Instructions
Upload a profile image for a user
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes | Base64 encoded file data | |
| userId | Yes | User ID |
Implementation Reference
- src/index.ts:599-623 (handler)Handler function that proxies the upload request to the Headlesshost API endpoint `/tools/files/users/${userId}/profile-image` using the provided base64 image data, handles the response or error.async ({ userId, image }) => { try { const payload = { image }; const response: AxiosResponse<ApiResponse> = await apiClient.post(`/tools/files/users/${userId}/profile-image`, payload); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } }
- src/index.ts:592-597 (schema)Zod input schema validating userId as string and image as base64 encoded string.title: "Upload User Profile Image", description: "Upload a profile image for a user", inputSchema: { userId: z.string().describe("User ID"), image: z.string().describe("Base64 encoded file data"), },
- src/index.ts:589-624 (registration)Registration of the 'upload_user_profile_image' tool using McpServer.registerTool, including title, description, input schema, and inline handler function.server.registerTool( "upload_user_profile_image", { title: "Upload User Profile Image", description: "Upload a profile image for a user", inputSchema: { userId: z.string().describe("User ID"), image: z.string().describe("Base64 encoded file data"), }, }, async ({ userId, image }) => { try { const payload = { image }; const response: AxiosResponse<ApiResponse> = await apiClient.post(`/tools/files/users/${userId}/profile-image`, payload); return { content: [ { type: "text", text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: handleApiError(error), }, ], isError: true, }; } } );