update_list_items
Update existing list items in Anaplan by specifying their IDs. Required code field prevents errors for items with code values.
Instructions
Update existing items in a list. Use get_list_items to find item IDs. Important: if an item has a code value, you must include the code field in the update or Anaplan returns an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspaceId | Yes | Anaplan workspace ID or name | |
| modelId | Yes | Anaplan model ID or name | |
| listId | Yes | List ID or name | |
| items | Yes | Items to update |
Implementation Reference
- src/tools/transactional.ts:69-87 (handler)MCP tool handler for 'update_list_items'. Defines Zod schema for inputs (workspaceId, modelId, listId, items with id/name/code/properties/parent/subsets), resolves IDs via NameResolver, and calls the API method updateListItems.
server.tool("update_list_items", "Update existing items in a list. Use get_list_items to find item IDs. Important: if an item has a code value, you must include the code field in the update or Anaplan returns an error.", { workspaceId: z.string().describe("Anaplan workspace ID or name"), modelId: z.string().describe("Anaplan model ID or name"), listId: z.string().describe("List ID or name"), items: z.array(z.object({ id: z.string().describe("Item ID (from get_list_items)"), name: z.string().optional().describe("New item name"), code: z.string().optional().describe("New item code"), properties: z.record(z.string(), z.string()).optional().describe("Updated properties"), parent: z.string().optional().describe("Parent item name for hierarchy placement"), subsets: z.record(z.string(), z.boolean()).optional().describe("Subset membership (subset name -> true/false)"), })).describe("Items to update"), }, async ({ workspaceId, modelId, listId, items }) => { const wId = await resolver.resolveWorkspace(workspaceId); const mId = await resolver.resolveModel(wId, modelId); const lId = await resolver.resolveList(wId, mId, listId); const result = await api.updateListItems(wId, mId, lId, items); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }); - src/api/transactional.ts:97-102 (helper)API helper method 'updateListItems' that sends a PUT request to /workspaces/{wId}/models/{mId}/lists/{lId}/items with the items payload.
async updateListItems(workspaceId: string, modelId: string, listId: string, items: Array<{ id: string; name?: string; code?: string; properties?: Record<string, string>; parent?: string; subsets?: Record<string, boolean> }>) { return this.client.put( `/workspaces/${workspaceId}/models/${modelId}/lists/${listId}/items`, { items } ); } - src/server.ts:63-63 (registration)Registration call: registerTransactionalTools(server, transactional, resolver) wires up the tool handler to the MCP server.
registerTransactionalTools(server, transactional, resolver); - src/resolver.ts:74-76 (helper)NameResolver.resolveList helper that resolves list names/IDs via the ListsApi.
async resolveList(workspaceId: string, modelId: string, nameOrId: string): Promise<string> { return this.resolve(`lists:${workspaceId}:${modelId}`, () => this.apis.lists.list(workspaceId, modelId), nameOrId, "List", "show_lists"); } - src/api/client.ts:26-28 (helper)AnaplanClient.put method that performs the HTTP PUT request used by updateListItems.
async put<T = any>(path: string, body?: unknown): Promise<T> { return this.request<T>("PUT", path, body); }