Skip to main content
Glama

syncSpecWithCollection

Idempotent

Initiates an asynchronous sync of an OpenAPI specification with its linked Postman collection. Returns HTTP 202 Accepted status.

Instructions

Syncs an API specification linked to a collection. This is an asynchronous endpoint that returns an HTTP `202 Accepted` response.

Note:

  • This endpoint only supports the OpenAPI 2.0, 3.0, and 3.1 specification types.

  • This endpoint only supports the OpenAPI 2.0 and 3.0 specification types.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
specIdYesThe spec's ID.
collectionUidYesThe collection's unique ID.

Implementation Reference

  • The main handler function that executes the tool logic. It makes a PUT request to `/specs/{specId}/synchronizations` with an optional `collectionUid` query parameter to sync an API specification with a collection.
    export async function handler(
      args: z.infer<typeof parameters>,
      extra: { client: PostmanAPIClient; headers?: IsomorphicHeaders; serverContext?: ServerContext }
    ): Promise<CallToolResult> {
      try {
        const endpoint = `/specs/${args.specId}/synchronizations`;
        const query = new URLSearchParams();
        if (args.collectionUid !== undefined) query.set('collectionUid', String(args.collectionUid));
        const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
        const options: any = {
          headers: extra.headers,
        };
        const result = await extra.client.put(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 tool's parameters: specId (string) and collectionUid (string).
    export const parameters = z.object({
      specId: z.string().describe("The spec's ID."),
      collectionUid: z.string().describe("The collection's unique ID."),
    });
  • Annotations for the tool: title, readOnlyHint=false, destructiveHint=false, idempotentHint=true.
    export const annotations = {
      title:
        'Syncs an API specification linked to a collection. This is an asynchronous endpoint that returns an HTTP \\`202 Accepted\\` response.',
      readOnlyHint: false,
      destructiveHint: false,
      idempotentHint: true,
    };
  • Tool is listed in the `full` enabled resources array (line 14) and in the `minimal` enabled resources array (line 193), meaning it's available in both full and minimal tool sets.
    const full = [
      // Collections
      'createCollection',
      'deleteCollection',
      'generateCollection',
      'getCollection',
      'getCollections',
      'patchCollection',
      'putCollection',
      'getCollectionTags',
      'updateCollectionTags',
      'getCollectionUpdatesTasks',
      'syncCollectionWithSpec',
      'syncSpecWithCollection',
      'generateSpecFromCollection',
      'getGeneratedCollectionSpecs',
      'getSpecCollections',
    
      // Collection Forks
      'getCollectionForks',
      'getSourceCollectionStatus',
      'getCollectionsForkedByUser',
      'pullCollectionChanges',
      'createCollectionFork',
      'mergeCollectionFork',
    
      // Collection Folders
      'createCollectionFolder',
      'deleteCollectionFolder',
      'getCollectionFolder',
      'updateCollectionFolder',
      'transferCollectionFolders',
    
      // Collection Requests
      'createCollectionRequest',
      'deleteCollectionRequest',
      'getCollectionRequest',
      'updateCollectionRequest',
      'transferCollectionRequests',
    
      // Collection Responses
      'createCollectionResponse',
      'deleteCollectionResponse',
      'getCollectionResponse',
      'updateCollectionResponse',
      'transferCollectionResponses',
    
      // Collection Runner
      'runCollection',
    
      // Comments
      'createCollectionComment',
      'deleteCollectionComment',
      'getCollectionComments',
      'updateCollectionComment',
      'updateApiCollectionComment',
      'createFolderComment',
      'deleteFolderComment',
      'getFolderComments',
      'updateFolderComment',
      'createRequestComment',
      'deleteRequestComment',
      'getRequestComments',
      'updateRequestComment',
      'createResponseComment',
      'deleteResponseComment',
      'getResponseComments',
      'updateResponseComment',
      'resolveCommentThread',
    
      // Environments
      'createEnvironment',
      'deleteEnvironment',
      'getEnvironment',
      'getEnvironments',
      'patchEnvironment',
      'putEnvironment',
    
      // Mocks
      'createMock',
      'deleteMock',
      'getMock',
      'getMocks',
      'updateMock',
      'publishMock',
      'unpublishMock',
    
      // Monitors
      'createMonitor',
      'deleteMonitor',
      'getMonitor',
      'getMonitors',
      'updateMonitor',
      'runMonitor',
    
      // Specs
      'createSpec',
      'deleteSpec',
      'getSpec',
      'getAllSpecs',
      'getSpecDefinition',
      'updateSpecProperties',
      'createSpecFile',
      'getSpecFile',
      'getSpecFiles',
      'updateSpecFile',
    
      // Workspaces
      'createWorkspace',
      'deleteWorkspace',
      'getWorkspace',
      'getWorkspaces',
      'updateWorkspace',
      'getWorkspaceGlobalVariables',
      'updateWorkspaceGlobalVariables',
      'getWorkspaceTags',
      'updateWorkspaceTags',
    
      // PAN (Private API Network)
      'listPrivateNetworkWorkspaces',
      'listPrivateNetworkAddRequests',
      'removeWorkspaceFromPrivateNetwork',
      'addWorkspaceToPrivateNetwork',
      'respondPrivateNetworkAddRequest',
    
      // // Documentation
      'publishDocumentation',
      'unpublishDocumentation',
    
      // Tasks and Status
      'getAsyncSpecTaskStatus',
      'getStatusOfAnAsyncApiTask',
    
      // User and Tags
      'getAuthenticatedUser',
      'getTaggedEntities',
    
      // Code Generation
      'getCodeGenerationInstructions',
    
      // Transfer
      'transferCollectionFolders',
      'transferCollectionResponses',
      'transferCollectionResponses',
    
      // 'asyncMergePullCollectionFork' skipped
      // 'asyncMergePullCollectionTaskStatus' skipped
    
      // Duplicate Collection
      'duplicateCollection',
      'getDuplicateCollectionTaskStatus',
      'deleteApiCollectionComment',
      'deleteSpecFile',
      'getEnabledTools',
      'searchPostmanElementsInPublicNetwork',
      'searchPostmanElementsInPrivateNetwork',
    
      // Analytics
      'getAnalyticsData',
      'getAnalyticsMetadata',
    ] as const;
  • The complete module file with exports: method='syncSpecWithCollection', description, parameters (zod schema), annotations, and handler function.
    import { z } from 'zod';
    import { PostmanAPIClient } from '../clients/postman.js';
    import { IsomorphicHeaders, CallToolResult } from '@modelcontextprotocol/sdk/types.js';
    import { ServerContext, asMcpError, McpError } from './utils/toolHelpers.js';
    
    export const method = 'syncSpecWithCollection';
    export const description =
      'Syncs an API specification linked to a collection. This is an asynchronous endpoint that returns an HTTP \\`202 Accepted\\` response.\n\n**Note:**\n\n- This endpoint only supports the OpenAPI 2.0, 3.0, and 3.1 specification types.\n- This endpoint only supports the OpenAPI 2.0 and 3.0 specification types.\n';
    export const parameters = z.object({
      specId: z.string().describe("The spec's ID."),
      collectionUid: z.string().describe("The collection's unique ID."),
    });
    export const annotations = {
      title:
        'Syncs an API specification linked to a collection. This is an asynchronous endpoint that returns an HTTP \\`202 Accepted\\` response.',
      readOnlyHint: false,
      destructiveHint: false,
      idempotentHint: true,
    };
    
    export async function handler(
      args: z.infer<typeof parameters>,
      extra: { client: PostmanAPIClient; headers?: IsomorphicHeaders; serverContext?: ServerContext }
    ): Promise<CallToolResult> {
      try {
        const endpoint = `/specs/${args.specId}/synchronizations`;
        const query = new URLSearchParams();
        if (args.collectionUid !== undefined) query.set('collectionUid', String(args.collectionUid));
        const url = query.toString() ? `${endpoint}?${query.toString()}` : endpoint;
        const options: any = {
          headers: extra.headers,
        };
        const result = await extra.client.put(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);
      }
    }
Behavior3/5

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

Annotations provide idempotentHint=true and non-destructive. Description adds async nature and 202 response. However, the contradictory supported spec types creates ambiguity about behavior.

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

Conciseness3/5

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

Description is short but contains redundant/contradictory notes. Could be more concise if correct supported types were stated once.

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

Completeness2/5

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

No output schema, but description doesn't explain response beyond status code 202; no info on how to track progress or handle errors. Sibling syncCollectionWithSpec exists but not differentiated.

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?

Input schema covers both required parameters (specId, collectionUid) with clear descriptions. Description adds no extra parameter semantics beyond schema, meeting baseline for 100% coverage.

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

Purpose3/5

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

The description states it syncs an API specification with a collection and is asynchronous, but the note contains a contradiction: first bullet says supports 3.1, second says only 2.0 and 3.0. This undermines clarity.

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

Usage Guidelines2/5

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

No guidance on when to use this tool vs. alternatives (e.g., syncCollectionWithSpec). The note only lists supported spec types but gives no context for selection.

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