affine_update_profile
Update user profile details such as display name and avatar URL on the AFFiNE MCP Server for improved workspace personalization and management.
Instructions
Update current user's profile information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| avatarUrl | No | Avatar URL | |
| name | No | Display name |
Implementation Reference
- src/tools/userCRUD.ts:8-30 (handler)The handler function `updateProfileHandler` that executes the GraphQL mutation to update the user's profile name and/or avatar URL.const updateProfileHandler = async ({ name, avatarUrl }: { name?: string; avatarUrl?: string }) => { try { const mutation = ` mutation UpdateProfile($input: UpdateUserInput!) { updateProfile(input: $input) { id name avatarUrl email } } `; const input: any = {}; if (name !== undefined) input.name = name; if (avatarUrl !== undefined) input.avatarUrl = avatarUrl; const data = await gql.request<{ updateProfile: any }>(mutation, { input }); return text(data.updateProfile); } catch (error: any) { return text({ error: error.message }); } };
- src/tools/userCRUD.ts:31-42 (registration)Registers the 'affine_update_profile' tool with the MCP server, including title, description, input schema using Zod, and binds it to the updateProfileHandler function.server.registerTool( "affine_update_profile", { title: "Update Profile", description: "Update current user's profile information.", inputSchema: { name: z.string().optional().describe("Display name"), avatarUrl: z.string().optional().describe("Avatar URL") } }, updateProfileHandler as any );
- src/tools/userCRUD.ts:36-39 (schema)Input schema definition using Zod for optional name and avatarUrl parameters.inputSchema: { name: z.string().optional().describe("Display name"), avatarUrl: z.string().optional().describe("Avatar URL") }