Skip to main content
Glama

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
NameRequiredDescriptionDefault
imageYesBase64 encoded file data
userIdYesUser ID

Implementation Reference

  • 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, }; } }
  • 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, }; } } );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Headlesshost/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server