Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
collectionIdYesThe collection's unique ID.
workspaceYesThe workspace ID in which to duplicate the collection.
suffixNoAn optional suffix to append to the duplicated collection's name.

Implementation Reference

  • 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(),
    });
  • Registration in the 'full' tools list in enabledResources.ts.
    'duplicateCollection',
    'getDuplicateCollectionTaskStatus',
  • Registration in the 'minimal' tools list in enabledResources.ts (also included for minimal mode).
    'duplicateCollection',
    'getDuplicateCollectionTaskStatus',
  • 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);
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description reveals that duplication is an asynchronous task by directing users to poll the task status endpoint. Since annotations do not provide behavioral context (readOnlyHint=false, destructiveHint=false), the description covers the essential behavior. It does not detail success/failure responses, but it sufficiently informs the agent that a follow-up step is needed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description consists of two concise sentences with no redundant information. It is front-loaded with the primary action and followed by a crucial instruction for follow-up, making it highly efficient for an AI agent to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema and minimal annotations, the description adequately explains the tool's purpose and workflow (asynchronous task with status polling). It is complete enough for an agent to understand the tool's role, though it could optionally mention the return value (taskId) explicitly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

All three parameters (collectionId, workspace, suffix) already have descriptions in the input schema (100% coverage). The tool description does not add any extra semantic information beyond what the schema provides, so a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Creates a duplicate of the given collection in another workspace,' specifying the verb (create), resource (collection), and unique action (duplicate into another workspace). It effectively distinguishes this tool from siblings like createCollection (which creates a new collection from scratch) and getDuplicateCollectionTaskStatus (which checks task status).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description indicates when to use this tool (to duplicate a collection into another workspace) and provides a link to a related endpoint for checking task status. However, it does not explicitly compare to alternatives like createCollection or putCollection, but the context is clear enough for an agent to decide.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/postmanlabs/postman-mcp-server'

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