duplicateCollection
Copy a Postman collection to another workspace, returning a task ID for status tracking. Optionally add a suffix to the duplicated collection name.
Instructions
Duplicates a collection to another workspace. Returns a task ID - use getDuplicateCollectionTaskStatus to check status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collectionId | Yes | The collection's unique ID | |
| workspace | Yes | Target workspace ID | |
| suffix | No | Optional suffix for duplicated collection name |
Implementation Reference
- tools/postman_tools.py:267-304 (handler)The DuplicateCollectionTool class implements the 'duplicateCollection' tool. It extends ToolHandler, registers with name 'duplicateCollection', defines input schema requiring 'collectionId' and 'workspace' with optional 'suffix', and its run_tool method POSTs to /collections/{collection_id}/duplicate.
class DuplicateCollectionTool(ToolHandler): """Duplicate a collection to another workspace""" def __init__(self): super().__init__("duplicateCollection") def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Duplicates a collection to another workspace. Returns a task ID - use getDuplicateCollectionTaskStatus to check status.", inputSchema={ "type": "object", "properties": { "collectionId": { "type": "string", "description": "The collection's unique ID" }, "workspace": { "type": "string", "description": "Target workspace ID" }, "suffix": { "type": "string", "description": "Optional suffix for duplicated collection name" } }, "required": ["collectionId", "workspace"] }, ) async def run_tool(self, args: dict) -> list[TextContent]: collection_id = args["collectionId"] body = {"workspace": args["workspace"]} if args.get("suffix"): body["suffix"] = args["suffix"] result = await postman_api_call("POST", f"/collections/{collection_id}/duplicate", body=body) return [TextContent(type="text", text=json.dumps(result, indent=2))] - tools/postman_tools.py:273-294 (schema)The schema definition for the duplicateCollection tool. It defines the input as an object with required fields 'collectionId' (string) and 'workspace' (string), and an optional 'suffix' (string).
def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Duplicates a collection to another workspace. Returns a task ID - use getDuplicateCollectionTaskStatus to check status.", inputSchema={ "type": "object", "properties": { "collectionId": { "type": "string", "description": "The collection's unique ID" }, "workspace": { "type": "string", "description": "Target workspace ID" }, "suffix": { "type": "string", "description": "Optional suffix for duplicated collection name" } }, "required": ["collectionId", "workspace"] }, - tools/postman_tools.py:1831-1844 (registration)The DuplicateCollectionTool is registered in the register_all_tools() function at line 1843, alongside other collection tools.
def register_all_tools() -> list[ToolHandler]: """Register all Postman tool handlers""" return [ # User Info GetAuthenticatedUserTool(), GetEnabledToolsTool(), # Collections CreateCollectionTool(), GetCollectionTool(), GetCollectionsTool(), PutCollectionTool(), DuplicateCollectionTool(), GetDuplicateCollectionTaskStatusTool(), - tools/toolhandler.py:9-13 (helper)The ToolHandler abstract base class that DuplicateCollectionTool extends. Provides the interface with name, get_tool_description(), and run_tool() methods.
class ToolHandler(ABC): """Base class for all Postman tool handlers""" def __init__(self, name: str): self.name = name