---
title: "corecluster_logs_context_get"
url: https://docs.corefinity.com/mcp/tools/corecluster_logs_context_get
type: tool
last_updated: 2026-11-13
feature: logs
related:
  - https://docs.corefinity.com/api/reference/logs/get-cluster-log-context.md
  - https://docs.corefinity.com/guides/sites/logs-and-monitoring/logs.md
---
# corecluster_logs_context_get

**Lines around a CoreCluster log line.** The lines around one line from corecluster_logs_query, oldest first. Send the query's sites and environment. Scope: read.

- Scope: `read`
- Runs as a task: no

## When to use it

The lines just before and after one log line from `corecluster_logs_query` (its stream and time), oldest first: what happened around it. Send the same `sites` and `environment` the query read.

## Inputs

- `cluster_id` (integer, ≥ 1, required): The CoreCluster.
- `sites` (array of integer, up to 200 items): The site ids (production rows) of this cluster to read, each once; omitted or empty: every site you may see on it. `corestack_site_list` with `cluster_id` names them.
- `environment` (one of `production`, `all`, default `"production"`): production (the default): each site's production row; all: its environments too.
- `line` (string, up to 200 characters, required): <stream_id>,<time> from a query line.
- `before` (integer, 0–100, default `20`)
- `after` (integer, 0–100, default `20`)

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "after": {
      "default": 20,
      "maximum": 100,
      "minimum": 0,
      "type": "integer"
    },
    "before": {
      "default": 20,
      "maximum": 100,
      "minimum": 0,
      "type": "integer"
    },
    "cluster_id": {
      "minimum": 1,
      "type": "integer"
    },
    "environment": {
      "default": "production",
      "enum": [
        "production",
        "all"
      ],
      "type": "string"
    },
    "line": {
      "description": "<stream_id>,<time> of a query line.",
      "maxLength": 200,
      "type": "string"
    },
    "sites": {
      "description": "Site ids; omitted: all.",
      "items": {
        "type": "integer"
      },
      "maxItems": 200,
      "type": "array"
    }
  },
  "required": [
    "cluster_id",
    "line"
  ],
  "type": "object"
}
```

## Refusals

- `line_not_found`: the line is not one this read may see — outside the retention, outside `sites` / `environment` or the token's pins, or not a line at all. Run the query again.
- `logs_not_collected`: none of the sites read has its logs collected on this cluster yet (or none is left after `sites`, `environment` and the token's pins); nothing to read.
- `logs_cluster_unavailable`: logs cannot be read at the moment; try again shortly.
- `tenant_mismatch` also answers a platform cluster, and a `sites` entry that is not one of this cluster's sites you may see.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

While the logs servers are busy a read answers `logs_busy`; try again in a few seconds.

## Example

```json
{
  "name": "corecluster_logs_context_get",
  "arguments": {
    "cluster_id": 812,
    "environment": "all",
    "line": "000000070000000081d2c4e9a1b3f5d7c9e0a2b4c6d8e0f1,2026-10-20T09:53:30Z"
  }
}
```

## The answer

`{line, before[], after[]}`, each line with its `site`; `before` and `after` oldest first.

## A token limited to some sites

The read holds only the rows the token's pins cover — its lines, and an export's file. A `sites` entry outside the pins
is `pin_refused` naming that site. Under a token limited to some environments of a site, leave `sites` out and send
`environment: "all"`: the read then covers exactly the rows the token may read.

## Prompt

```text
Using the Corefinity MCP server, call corecluster_logs_context_get with cluster_id 812, environment all, line 000000070000000081d2c4e9a1b3f5d7c9e0a2b4c6d8e0f1,2026-10-20T09:53:30Z. (Lines around a CoreCluster log line.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [GET /api/corestack/clusters/{cluster}/logs/context](https://docs.corefinity.com/api/reference/logs/get-cluster-log-context.md)
- Guide: [Logs](https://docs.corefinity.com/guides/sites/logs-and-monitoring/logs.md)
