Skip to main content
Glama

update_list

Modify existing list contents by replacing items with a new array to add, remove, or reorder elements 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 that checks if the list exists by ID, updates the items in the global 'lists' Map, and returns a success message with old and new item counts or an error if list not found.
    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.`, }, ], }; },
  • Input schema definition using Zod for validating list_id (string) and items (array of strings), along with tool description.
    { 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.", ), }, },
  • src/index.ts:352-396 (registration)
    Registration of the 'update_list' tool using McpServer.registerTool, including schema and handler.
    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.`, }, ], }; }, );
  • Global Map storing all lists by ID, used by update_list to check existence and update contents.
    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