> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognigy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Import and remove an MCP server's tools

> Imports and refreshes an MCP server's tools, and removes the tools you name in `remove`. For each imported remote tool, it creates one tool row, or refreshes the row if the tool is already imported. Removing a tool also detaches it from every agent and skill that referenced it. The intent must be explicit: if you omit a name, nothing is removed. Every requested name is checked against what the server currently offers, so a stale or invented name is rejected per item instead of stored. Values are re-read from the server on every call, so this is also the re-sync operation. `projectId` is required as a query parameter.



## OpenAPI

````yaml https://api-trial.cognigy.ai/swagger/openapi.json post /mcp-servers/{id}/tools/sync
openapi: 3.0.3
info:
  contact:
    email: support@example.com
    name: API Support
  description: API for managing agents and related resources
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  termsOfService: http://swagger.io/terms/
  title: Agents API
  version: '1.0'
servers:
  - url: https://api-trial.cognigy.ai/v1
security:
  - ApiKey: []
tags:
  - name: Agents
  - name: Brand personas
  - name: Tools
  - name: Built-in tools
  - name: Skills
  - name: Built-in skills
  - name: MCP servers
  - name: Tool references
paths:
  /mcp-servers/{id}/tools/sync:
    post:
      tags:
        - MCP servers
      summary: Import and remove an MCP server's tools
      description: >-
        Imports and refreshes an MCP server's tools, and removes the tools you
        name in `remove`. For each imported remote tool, it creates one tool
        row, or refreshes the row if the tool is already imported. Removing a
        tool also detaches it from every agent and skill that referenced it. The
        intent must be explicit: if you omit a name, nothing is removed. Every
        requested name is checked against what the server currently offers, so a
        stale or invented name is rejected per item instead of stored. Values
        are re-read from the server on every call, so this is also the re-sync
        operation. `projectId` is required as a query parameter.
      parameters:
        - description: The unique identifier for the mcp server.
          in: path
          name: id
          required: true
          schema:
            type: string
        - description: The unique identifier for the project.
          in: query
          name: projectId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/internal_mcpservers.SyncToolsRequest'
        description: What to import and what to remove
        required: true
        x-originalParamName: request
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/internal_mcpservers.SyncToolsResponse'
          description: Sync completed; individual items may still carry an error
        '400':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailBadRequest
          description: >-
            Invalid ID or body, or the MCP server refused the request (HTTP 401
            or 403). The whole batch depends on one live listing
        '403':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailForbidden
          description: Access denied, or projectId missing
        '404':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailNotFound
          description: MCP server not found
        '500':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailInternalError
          description: Internal server error
        '502':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailBadGateway
          description: The MCP server could not be reached
components:
  schemas:
    internal_mcpservers.SyncToolsRequest:
      properties:
        import:
          description: >-
            Import names remote tools to import, exactly as discovery reported
            them.

            A name that already has a row is an idempotent refresh, which is
            what

            makes this the re-sync operation too.
          example:
            - search_issues
            - create_issue
          items:
            type: string
          type: array
        remove:
          description: >-
            Remove names imported rows by their tool referenceId. Deleting a row
            IS

            the opt-out, and it detaches the tool from every agent and skill
            that

            referenced it.
          example:
            - 550e8400-e29b-41d4-a716-446655440000
          items:
            type: string
          type: array
        reviewedToolNames:
          description: >-
            ReviewedToolNames is the catalogue the client actually DISPLAYED to
            the

            customer in the dialog it is now saving — every remote tool name it
            showed,

            imported or not.


            It is what makes declining a tool a recordable decision, and it has
            to come

            from the client because only the client knows what it rendered. The

            customer saw the discovery that opened the dialog; the server
            discovers

            again at Save, so a tool added in between would otherwise be stamped
            as

            reviewed without ever having been shown, and `newSinceReview` would
            never

            flag it.


            OPTIONAL and back-compatible. Omit it and the server falls back to
            the

            catalogue it discovers during this request, which is the previous

            behaviour. An explicit empty array is a real answer ("the server
            offered

            nothing") and is recorded as one, so send `null`/omit rather than
            `[]` when

            you mean "I am not telling you".
          example:
            - search_issues
            - create_issue
          items:
            type: string
          type: array
      type: object
    internal_mcpservers.SyncToolsResponse:
      properties:
        items:
          description: >-
            Items has one entry per requested item, imports first then removals,
            in

            request order.
          items:
            $ref: '#/components/schemas/internal_mcpservers.SyncResultResponse'
          type: array
        total:
          example: 2
          type: integer
      type: object
    github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailBadRequest:
      properties:
        detail:
          example: request body validation failed
          type: string
        errors:
          items:
            $ref: >-
              #/components/schemas/github_com_cognigy_ai-agents-v2_internal_middleware.FieldError
          type: array
        instance:
          example: /v1/{resource}
          type: string
        status:
          example: 400
          type: integer
        title:
          example: Bad Request
          type: string
        traceId:
          example: api--a4d2f126-bec4-4544-a049-7c0cf08524ed
          type: string
        type:
          example: about:blank
          type: string
      type: object
    github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailForbidden:
      properties:
        detail:
          example: 'access denied: insufficient permissions'
          type: string
        instance:
          example: /v1/{resource}/{id}
          type: string
        status:
          example: 403
          type: integer
        title:
          example: Forbidden
          type: string
        traceId:
          example: api--a4d2f126-bec4-4544-a049-7c0cf08524ed
          type: string
        type:
          example: about:blank
          type: string
      type: object
    github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailNotFound:
      properties:
        detail:
          example: the requested resource does not exist
          type: string
        instance:
          example: /v1/{resource}/{id}
          type: string
        status:
          example: 404
          type: integer
        title:
          example: Not Found
          type: string
        traceId:
          example: api--a4d2f126-bec4-4544-a049-7c0cf08524ed
          type: string
        type:
          example: about:blank
          type: string
      type: object
    github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailInternalError:
      properties:
        detail:
          example: internal server error
          type: string
        instance:
          example: /v1/{resource}
          type: string
        status:
          example: 500
          type: integer
        title:
          example: Internal Server Error
          type: string
        traceId:
          example: api--a4d2f126-bec4-4544-a049-7c0cf08524ed
          type: string
        type:
          example: about:blank
          type: string
      type: object
    github_com_cognigy_ai-agents-v2_internal_middleware.ProblemDetailBadGateway:
      properties:
        detail:
          example: the MCP server did not respond
          type: string
        instance:
          example: /v1/{resource}/{id}
          type: string
        status:
          example: 502
          type: integer
        title:
          example: Bad Gateway
          type: string
        traceId:
          example: api--a4d2f126-bec4-4544-a049-7c0cf08524ed
          type: string
        type:
          example: about:blank
          type: string
      type: object
    internal_mcpservers.SyncResultResponse:
      properties:
        error:
          description: Error explains a rejection; absent otherwise.
          type: string
        status:
          description: >-
            Status is added / updated / unchanged / removed / rejected.
            "unchanged"

            means the stored values already matched the server, so nothing was

            rewritten.
          enum:
            - added
            - updated
            - unchanged
            - removed
            - rejected
          example: added
          type: string
        toolId:
          description: ToolId is the row's id, set for every successful item.
          example: 507f1f77bcf86cd799439011
          type: string
        toolName:
          description: ToolName is set for an import item.
          example: search_issues
          type: string
        toolReferenceId:
          description: >-
            ToolReferenceId is set for a removal item and for a successful
            import —

            the caller needs it to attach the new tool to an agent.
          example: 550e8400-e29b-41d4-a716-446655440000
          type: string
      type: object
    github_com_cognigy_ai-agents-v2_internal_middleware.FieldError:
      properties:
        field:
          type: string
        message:
          type: string
      type: object
  securitySchemes:
    ApiKey:
      description: '[Production] API key for production authentication'
      in: header
      name: X-API-Key
      type: apiKey

````