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

**Lines around a log line.** The lines just before and after one log line from a query (its stream and time), oldest first: what happened around it. Scope: read.

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

## When to use it

The lines just before and after one log line from a query (its stream and time), oldest first: what happened around it.

## Inputs

- `site_id` (integer, ≥ 1, required): The site (any of its environments answers for its group).
- `environment_id` (integer, ≥ 1): A row of the same site: production or one of its environments. Omitted: the row site_id names.
- `scope` (one of `env`, `site`, default `"env"`): env (the default): that one row; site: every environment of the site you may see.
- `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"
    },
    "environment_id": {
      "description": "Production or an environment of the same site; omitted: site_id's row.",
      "minimum": 1,
      "type": "integer"
    },
    "line": {
      "description": "<stream_id>,<time> from a query line.",
      "maxLength": 200,
      "type": "string"
    },
    "scope": {
      "default": "env",
      "description": "site: every environment of the site you may see.",
      "enum": [
        "env",
        "site"
      ],
      "type": "string"
    },
    "site_id": {
      "description": "The site (any of its environments answers for its group).",
      "minimum": 1,
      "type": "integer"
    }
  },
  "required": [
    "site_id",
    "line"
  ],
  "type": "object"
}
```

## Refusals

- `line_not_found`: the log line is no longer in the window; run the query again.
- 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).

## Example

```json
{
  "name": "corestack_logs_context_get",
  "arguments": {
    "site_id": 4211,
    "line": "9f3c2a7b1e4d6058,1760745600123456789"
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_logs_context_get with site_id 4211, line 9f3c2a7b1e4d6058,1760745600123456789. (Lines around a log line.) Tell me what it returned.
```

## The same task elsewhere

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