Update Collection
update_collectionUpdate an existing collection's display name and slug. Provide the current slug, new name, and new slug.
Instructions
Update the name and slug of an existing collection
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"slug": "<slug>",
"name": "<name>",
"new_slug": "<new_slug>"
},
"name": "update_collection"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | Current slug of the collection to update | |
| name | Yes | New display name | |
| new_slug | Yes | New slug |
Implementation Reference
- src/tools/collections.ts:110-118 (handler)The async handler function that executes the update_collection tool logic. It calls client.put to send name and new_slug to /collections/{slug}.
}, async ({ slug, name, new_slug }) => { const result = await client.put(`/collections/${slug}`, { name, slug: new_slug, }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }); - src/tools/collections.ts:105-109 (schema)Input schema for update_collection: slug (current slug, required), name (new display name, required), new_slug (new slug, required), all defined as Zod strings.
inputSchema: { slug: z.string().describe("Current slug of the collection to update"), name: z.string().describe("New display name"), new_slug: z.string().describe("New slug"), }, - src/tools/collections.ts:102-118 (registration)Registration of the 'update_collection' tool via server.registerTool, including title 'Update Collection' and description.
server.registerTool("update_collection", { title: "Update Collection", description: "Update the name and slug of an existing collection", inputSchema: { slug: z.string().describe("Current slug of the collection to update"), name: z.string().describe("New display name"), new_slug: z.string().describe("New slug"), }, }, async ({ slug, name, new_slug }) => { const result = await client.put(`/collections/${slug}`, { name, slug: new_slug, }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }); - src/index.ts:36-36 (registration)Where registerCollectionTools (which registers the update_collection tool) is called from the main entry point.
registerCollectionTools(server, client); - src/client.ts:124-132 (helper)The ElmapiClient.put method used by the update_collection handler to send the PUT request to the API.
async put(path: string, body?: unknown): Promise<unknown> { const response = await fetch(`${this.baseUrl}${path}`, { method: "PUT", headers: this.headers(), body: body ? JSON.stringify(body) : undefined, }); return this.handleResponse(response); }