Update Profile
update_profileModify your display name or avatar URL to update your profile information.
Instructions
Update current user's profile information.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Display name | |
| avatarUrl | No | Avatar URL |
Implementation Reference
- src/tools/userCRUD.ts:6-42 (handler)The updateProfileHandler function (lines 8-30) executes the tool logic by constructing a GraphQL mutation to update the user profile, calling the GraphQL client, and returning the result. The tool is registered via server.registerTool on line 31-42 with name 'update_profile', Zod schema for 'name' and 'avatarUrl' inputs, and the handler.
export function registerUserCRUDTools(server: McpServer, gql: GraphQLClient) { // UPDATE PROFILE 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 }); } }; server.registerTool( "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:31-42 (registration)Registers the tool 'update_profile' on the MCP server with its title, description, input schema (name and avatarUrl as optional strings), and the updateProfileHandler function.
server.registerTool( "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:32-39 (schema)The input schema definition for the tool, specifying name (optional string, 'Display name') and avatarUrl (optional string, 'Avatar URL') via Zod.
"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") } - src/tools/userCRUD.ts:1-5 (helper)Imports: McpServer from SDK, z from zod for schema validation, GraphQLClient for API calls, and the text helper from util/mcp.ts which formats responses as MCP text content.
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; import { GraphQLClient } from "../graphqlClient.js"; import { text } from "../util/mcp.js"; - src/index.ts:11-11 (registration)Imports registerUserCRUDTools from userCRUD.ts, which is called on line 185 to register the update_profile tool on the server during startup.
import { registerUserCRUDTools } from "./tools/userCRUD.js";