Сессии инструментов.
Сессии инструментов Context4: создание, настройка, доступные действия и получение динамического MCP URL через API.
Сгенерировано из публичного OpenAPI Context4. Авторизация: Authorization: Bearer с API-ключом. Общие правила — API. Полный контракт — OpenAPI JSON. В JSON ниже $ref указывает на именованную схему из раздела «Схемы».
createToolSession
POST /v1/tool-sessions
URL этого стенда: https://context4.me/v1/tool-sessions. Параметры в фигурных скобках заменяются фактическими ID из API.
Create a tool session (returns the per-session MCP URL)
Полномочие: tool-sessions:write.
Параметры
| Имя | Где | Обязателен | Тип и ограничения |
|---|---|---|---|
Idempotency-Key | header | да | {"type":"string"} Client-chosen key (8-128 chars of [A-Za-z0-9._:-]); replays with the same payload return the original outcome |
Тело запроса
Обязательно. CreateToolSessionRequest
{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateToolSessionRequest"
}
}
}
}Ответы и ошибки
| HTTP | Значение | Формат и схема |
|---|---|---|
| 201 | The created session with its per-session MCP URL | application/json ToolSessionWithMcp |
| 400 | Problem (validation_failed) | application/problem+json Problem |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | application/problem+json Problem |
| 403 | Problem (capability_missing, forbidden) | application/problem+json Problem |
| 404 | Problem (not_found) | application/problem+json Problem |
| 409 | Problem (conflict) | application/problem+json Problem |
| 429 | Problem (rate_limited) | application/problem+json Problem |
| 500 | Problem (internal) | application/problem+json Problem |
| 503 | Problem (service_unavailable) | application/problem+json Problem |
Заголовки успешного ответа:
{
"X-Request-Id": {
"description": "Correlation id echoed on every response",
"schema": {
"type": "string"
}
},
"RateLimit-Limit": {
"description": "Per-key request limit for the current window",
"schema": {
"type": "integer"
}
},
"RateLimit-Remaining": {
"description": "Requests remaining in the current window",
"schema": {
"type": "integer"
}
},
"RateLimit-Reset": {
"description": "Seconds until the current window resets",
"schema": {
"type": "integer"
}
}
}getToolSession
GET /v1/tool-sessions/{toolSessionId}
URL этого стенда: https://context4.me/v1/tool-sessions/{toolSessionId}. Параметры в фигурных скобках заменяются фактическими ID из API.
Get one tool session with its configuration
Полномочие: tool-sessions:read.
Параметры
| Имя | Где | Обязателен | Тип и ограничения |
|---|---|---|---|
toolSessionId | path | да | {"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"} |
Ответы и ошибки
| HTTP | Значение | Формат и схема |
|---|---|---|
| 200 | The session view including its configuration | application/json ToolSession |
| 400 | Problem (validation_failed) | application/problem+json Problem |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | application/problem+json Problem |
| 403 | Problem (capability_missing, forbidden) | application/problem+json Problem |
| 404 | Problem (not_found) | application/problem+json Problem |
| 429 | Problem (rate_limited) | application/problem+json Problem |
| 500 | Problem (internal) | application/problem+json Problem |
| 503 | Problem (service_unavailable) | application/problem+json Problem |
Заголовки успешного ответа:
{
"X-Request-Id": {
"description": "Correlation id echoed on every response",
"schema": {
"type": "string"
}
},
"RateLimit-Limit": {
"description": "Per-key request limit for the current window",
"schema": {
"type": "integer"
}
},
"RateLimit-Remaining": {
"description": "Requests remaining in the current window",
"schema": {
"type": "integer"
}
},
"RateLimit-Reset": {
"description": "Seconds until the current window resets",
"schema": {
"type": "integer"
}
}
}patchToolSession
PATCH /v1/tool-sessions/{toolSessionId}
URL этого стенда: https://context4.me/v1/tool-sessions/{toolSessionId}. Параметры в фигурных скобках заменяются фактическими ID из API.
Update session tool enablement (CAS)
Полномочие: tool-sessions:write.
Параметры
| Имя | Где | Обязателен | Тип и ограничения |
|---|---|---|---|
toolSessionId | path | да | {"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"} |
Тело запроса
Обязательно. PatchToolSessionRequest
{
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PatchToolSessionRequest"
}
}
}
}Ответы и ошибки
| HTTP | Значение | Формат и схема |
|---|---|---|
| 200 | The updated session view | application/json ToolSession |
| 400 | Problem (validation_failed) | application/problem+json Problem |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | application/problem+json Problem |
| 403 | Problem (capability_missing, forbidden) | application/problem+json Problem |
| 404 | Problem (not_found) | application/problem+json Problem |
| 409 | Problem (conflict) | application/problem+json Problem |
| 429 | Problem (rate_limited) | application/problem+json Problem |
| 500 | Problem (internal) | application/problem+json Problem |
| 503 | Problem (service_unavailable) | application/problem+json Problem |
Заголовки успешного ответа:
{
"X-Request-Id": {
"description": "Correlation id echoed on every response",
"schema": {
"type": "string"
}
},
"RateLimit-Limit": {
"description": "Per-key request limit for the current window",
"schema": {
"type": "integer"
}
},
"RateLimit-Remaining": {
"description": "Requests remaining in the current window",
"schema": {
"type": "integer"
}
},
"RateLimit-Reset": {
"description": "Seconds until the current window resets",
"schema": {
"type": "integer"
}
}
}listToolSessionTools
GET /v1/tool-sessions/{toolSessionId}/tools
URL этого стенда: https://context4.me/v1/tool-sessions/{toolSessionId}/tools. Параметры в фигурных скобках заменяются фактическими ID из API.
Session-scoped tool discovery (pinned snapshot, exposed tools only)
Полномочие: tool-sessions:read.
Параметры
| Имя | Где | Обязателен | Тип и ограничения |
|---|---|---|---|
toolSessionId | path | да | {"type":"string","format":"uuid","example":"9b2f6f2e-4b0a-4bd2-8b7e-3f8a1c2d4e5f"} |
cursor | query | нет | {"type":"string","minLength":1,"maxLength":400,"pattern":"^[A-Za-z0-9_-]+$","description":"Opaque pagination cursor from a previous response"} Opaque pagination cursor from a previous response |
limit | query | нет | {"type":"integer","minimum":1,"maximum":100,"description":"Page size (1-100, default 20)"} Page size (1-100, default 20) |
Ответы и ошибки
| HTTP | Значение | Формат и схема |
|---|---|---|
| 200 | The session's exposed tools with pinned schemas | application/json SessionToolListResponse |
| 400 | Problem (validation_failed) | application/problem+json Problem |
| 401 | Problem (authentication_required, invalid_api_key, api_key_expired, api_key_revoked) | application/problem+json Problem |
| 403 | Problem (capability_missing, forbidden) | application/problem+json Problem |
| 404 | Problem (not_found) | application/problem+json Problem |
| 429 | Problem (rate_limited) | application/problem+json Problem |
| 500 | Problem (internal) | application/problem+json Problem |
| 503 | Problem (service_unavailable) | application/problem+json Problem |
Заголовки успешного ответа:
{
"X-Request-Id": {
"description": "Correlation id echoed on every response",
"schema": {
"type": "string"
}
},
"RateLimit-Limit": {
"description": "Per-key request limit for the current window",
"schema": {
"type": "integer"
}
},
"RateLimit-Remaining": {
"description": "Requests remaining in the current window",
"schema": {
"type": "integer"
}
},
"RateLimit-Reset": {
"description": "Seconds until the current window resets",
"schema": {
"type": "integer"
}
}
}