update_account
Modify account details such as name and other information within the Kapiti platform's user management system.
Instructions
Update account information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Account name |
Implementation Reference
- src/index.ts:557-583 (handler)Handler function that executes the update_account tool logic: constructs payload with optional 'name' and sends PUT request to /tools/membership/account endpoint, returns formatted response or error.async ({ name }) => { try { const payload: any = {}; if (name) payload.name = name; const response: AxiosResponse<ApiResponse<Account>> = await apiClient.put("/tools/membership/account", 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:553-555 (schema)Zod input schema defining optional 'name' parameter for the update_account tool.inputSchema: { name: z.string().optional().describe("Account name"), },
- src/index.ts:548-584 (registration)MCP server registration of the 'update_account' tool with title, description, input schema, and inline handler.server.registerTool( "update_account", { title: "Update Account", description: "Update account information", inputSchema: { name: z.string().optional().describe("Account name"), }, }, async ({ name }) => { try { const payload: any = {}; if (name) payload.name = name; const response: AxiosResponse<ApiResponse<Account>> = await apiClient.put("/tools/membership/account", 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:66-75 (schema)TypeScript interface for Account entity, typed for API responses in update_account tool.interface Account { id: string; name: string; description?: string; website?: string; contactEmail?: string; contactPhone?: string; createdAt: string; updatedAt: string; }
- src/index.ts:158-166 (helper)Helper function used in the tool handler to format and return API error messages.function handleApiError(error: any): string { if (error.response) { return `API Error ${error.response.status}: ${error.response.data?.message || error.response.statusText}`; } else if (error.request) { return "Network Error: Unable to reach API server"; } else { return `Error: ${error.message}`; } }