Skip to main content
Glama

update_list

Modify existing lists by replacing items with new arrays to add, remove, or reorder content in the par5-mcp server.

Instructions

Updates an existing list by replacing its items with a new array.

WHEN TO USE:

  • To modify the contents of an existing list

  • To add or remove items from a list

  • To reorder items in a list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYesThe list ID returned by create_list.
itemsYesThe new array of items to replace the existing list contents.

Implementation Reference

  • Handler function for the 'update_list' tool. Checks if the list exists, updates the items in the shared 'lists' Map, and returns a success message with old and new item counts.
    async ({ list_id, items }) => { if (!lists.has(list_id)) { return { content: [ { type: "text", text: `Error: No list found with ID "${list_id}". The list may have been deleted or the ID is incorrect. Use create_list to create a new list.`, }, ], isError: true, }; } const oldCount = lists.get(list_id)?.length; lists.set(list_id, items); return { content: [ { type: "text", text: `Successfully updated list "${list_id}". Changed from ${oldCount} items to ${items.length} items.`, }, ], }; },
  • Zod inputSchema for 'update_list' tool defining parameters: list_id (string) and items (array of strings).
    inputSchema: { list_id: z.string().describe("The list ID returned by create_list."), items: z .array(z.string()) .describe( "The new array of items to replace the existing list contents.", ), },
  • src/index.ts:339-382 (registration)
    server.registerTool call registering the 'update_list' tool with its metadata (description and inputSchema) and handler function.
    server.registerTool( "update_list", { description: `Updates an existing list by replacing its items with a new array. WHEN TO USE: - To modify the contents of an existing list - To add or remove items from a list - To reorder items in a list`, inputSchema: { list_id: z.string().describe("The list ID returned by create_list."), items: z .array(z.string()) .describe( "The new array of items to replace the existing list contents.", ), }, }, async ({ list_id, items }) => { if (!lists.has(list_id)) { return { content: [ { type: "text", text: `Error: No list found with ID "${list_id}". The list may have been deleted or the ID is incorrect. Use create_list to create a new list.`, }, ], isError: true, }; } const oldCount = lists.get(list_id)?.length; lists.set(list_id, items); return { content: [ { type: "text", text: `Successfully updated list "${list_id}". Changed from ${oldCount} items to ${items.length} items.`, }, ], }; }, );
  • Shared 'lists' Map<string, string[]> used by update_list (and other list tools) to store list items by ID.
    const lists = new Map<string, string[]>();

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/jrandolf/par5-mcp'

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