CircleCI · Capability

CircleCI REST API v2 — Context

CircleCI REST API v2 — Context. 7 operations. Lead operation: List contexts. Self-contained Naftiko capability covering one Circleci business surface.

Run with Naftiko CircleciContext

What You Can Do

GET
Listcontexts — List contexts
/v1/context
POST
Createcontext — Create a context
/v1/context
GET
Getcontext — Get a context
/v1/context/{context-id}
DELETE
Deletecontext — Delete a context
/v1/context/{context-id}
GET
Listcontextenvironmentvariables — List environment variables in a context
/v1/context/{context-id}/environment-variable
PUT
Addorupdatecontextenvironmentvariable — Add or update an environment variable
/v1/context/{context-id}/environment-variable/{env-var-name}
DELETE
Deletecontextenvironmentvariable — Remove an environment variable
/v1/context/{context-id}/environment-variable/{env-var-name}

MCP Tools

list-contexts

List contexts

read-only idempotent
create-context

Create a context

get-context

Get a context

read-only idempotent
delete-context

Delete a context

idempotent
list-environment-variables-context

List environment variables in a context

read-only idempotent
add-update-environment-variable

Add or update an environment variable

idempotent
remove-environment-variable

Remove an environment variable

idempotent

Capability Spec

rest-api-v2-context.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: CircleCI REST API v2 — Context
  description: 'CircleCI REST API v2 — Context. 7 operations. Lead operation: List contexts. Self-contained Naftiko capability
    covering one Circleci business surface.'
  tags:
  - Circleci
  - Context
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    CIRCLECI_API_KEY: CIRCLECI_API_KEY
capability:
  consumes:
  - type: http
    namespace: rest-api-v2-context
    baseUri: https://circleci.com/api/v2
    description: CircleCI REST API v2 — Context business capability. Self-contained, no shared references.
    resources:
    - name: context
      path: /context
      operations:
      - name: listcontexts
        method: GET
        description: List contexts
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: createcontext
        method: POST
        description: Create a context
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: context-context-id
      path: /context/{context-id}
      operations:
      - name: getcontext
        method: GET
        description: Get a context
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: deletecontext
        method: DELETE
        description: Delete a context
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: context-context-id-environment-variable
      path: /context/{context-id}/environment-variable
      operations:
      - name: listcontextenvironmentvariables
        method: GET
        description: List environment variables in a context
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: context-context-id-environment-variable-env-var-name
      path: /context/{context-id}/environment-variable/{env-var-name}
      operations:
      - name: addorupdatecontextenvironmentvariable
        method: PUT
        description: Add or update an environment variable
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
      - name: deletecontextenvironmentvariable
        method: DELETE
        description: Remove an environment variable
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    authentication:
      type: apikey
      key: Circle-Token
      value: '{{env.CIRCLECI_API_KEY}}'
      placement: header
  exposes:
  - type: rest
    namespace: rest-api-v2-context-rest
    port: 8080
    description: REST adapter for CircleCI REST API v2 — Context. One Spectral-compliant resource per consumed operation,
      prefixed with /v1.
    resources:
    - path: /v1/context
      name: context
      description: REST surface for context.
      operations:
      - method: GET
        name: listcontexts
        description: List contexts
        call: rest-api-v2-context.listcontexts
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: createcontext
        description: Create a context
        call: rest-api-v2-context.createcontext
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/context/{context-id}
      name: context-context-id
      description: REST surface for context-context-id.
      operations:
      - method: GET
        name: getcontext
        description: Get a context
        call: rest-api-v2-context.getcontext
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: deletecontext
        description: Delete a context
        call: rest-api-v2-context.deletecontext
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/context/{context-id}/environment-variable
      name: context-context-id-environment-variable
      description: REST surface for context-context-id-environment-variable.
      operations:
      - method: GET
        name: listcontextenvironmentvariables
        description: List environment variables in a context
        call: rest-api-v2-context.listcontextenvironmentvariables
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/context/{context-id}/environment-variable/{env-var-name}
      name: context-context-id-environment-variable-env-var-name
      description: REST surface for context-context-id-environment-variable-env-var-name.
      operations:
      - method: PUT
        name: addorupdatecontextenvironmentvariable
        description: Add or update an environment variable
        call: rest-api-v2-context.addorupdatecontextenvironmentvariable
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: deletecontextenvironmentvariable
        description: Remove an environment variable
        call: rest-api-v2-context.deletecontextenvironmentvariable
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: rest-api-v2-context-mcp
    port: 9090
    transport: http
    description: MCP adapter for CircleCI REST API v2 — Context. One tool per consumed operation, routed inline through this
      capability's consumes block.
    tools:
    - name: list-contexts
      description: List contexts
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: rest-api-v2-context.listcontexts
      outputParameters:
      - type: object
        mapping: $.
    - name: create-context
      description: Create a context
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: rest-api-v2-context.createcontext
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: get-context
      description: Get a context
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: rest-api-v2-context.getcontext
      outputParameters:
      - type: object
        mapping: $.
    - name: delete-context
      description: Delete a context
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: rest-api-v2-context.deletecontext
      outputParameters:
      - type: object
        mapping: $.
    - name: list-environment-variables-context
      description: List environment variables in a context
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: rest-api-v2-context.listcontextenvironmentvariables
      outputParameters:
      - type: object
        mapping: $.
    - name: add-update-environment-variable
      description: Add or update an environment variable
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: rest-api-v2-context.addorupdatecontextenvironmentvariable
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: remove-environment-variable
      description: Remove an environment variable
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: rest-api-v2-context.deletecontextenvironmentvariable
      outputParameters:
      - type: object
        mapping: $.