duplicateCollection
Duplicate a collection into a specified workspace, optionally appending a suffix to the copy's name.
Instructions
Creates a duplicate of the given collection in another workspace.
Use the GET `/collection-duplicate-tasks/{taskId}` endpoint to get the duplication task's current status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collectionId | Yes | The collection's unique ID. | |
| workspace | Yes | The workspace ID in which to duplicate the collection. | |
| suffix | No | An optional suffix to append to the duplicated collection's name. |
Implementation Reference
- src/tools/duplicateCollection.ts:24-55 (handler)The handler function that executes the 'duplicateCollection' tool logic. It sends a POST request to /collections/{collectionId}/duplicates with workspace and optional suffix in the body.
export async function handler( args: z.infer<typeof parameters>, extra: { client: PostmanAPIClient; headers?: IsomorphicHeaders; serverContext?: ServerContext } ): Promise<CallToolResult> { try { const endpoint = `/collections/${args.collectionId}/duplicates`; const query = new URLSearchParams(); const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint; const bodyPayload: any = {}; if (args.workspace !== undefined) bodyPayload.workspace = args.workspace; if (args.suffix !== undefined) bodyPayload.suffix = args.suffix; const options: any = { body: JSON.stringify(bodyPayload), contentType: ContentType.Json, headers: extra.headers, }; const result = await extra.client.post(url, options); return { content: [ { type: 'text', text: `${typeof result === 'string' ? result : JSON.stringify(result, null, 2)}`, }, ], }; } catch (e: unknown) { if (e instanceof McpError) { throw e; } throw asMcpError(e); } } - Zod schema defining the input parameters: collectionId (string, required), workspace (string, required), suffix (string, optional).
export const parameters = z.object({ collectionId: z.string().describe("The collection's unique ID."), workspace: z.string().describe('The workspace ID in which to duplicate the collection.'), suffix: z .string() .describe("An optional suffix to append to the duplicated collection's name.") .optional(), }); - src/enabledResources.ts:150-151 (registration)Registration in the 'full' tools list in enabledResources.ts.
'duplicateCollection', 'getDuplicateCollectionTaskStatus', - src/enabledResources.ts:200-201 (registration)Registration in the 'minimal' tools list in enabledResources.ts (also included for minimal mode).
'duplicateCollection', 'getDuplicateCollectionTaskStatus', - src/tools/utils/toolHelpers.ts:10-13 (helper)The asMcpError helper function used to convert unknown errors into McpError instances.
export function asMcpError(error: unknown): McpError { const cause = (error as any)?.cause ?? String(error); return new McpError(ErrorCode.InternalError, cause); }