UNPKG

@upstash/context7-mcp

Version:
16 lines (15 loc) • 542 B
import { AsyncLocalStorage } from "node:async_hooks"; const operationScope = new AsyncLocalStorage(); export function runInMcpOperationScope(target, callback) { return operationScope.run(target, callback); } export function markCurrentMcpOperationError(errorType = "tool_error") { const target = operationScope.getStore(); if (target) target.errorType = errorType; } export function markCurrentMcpToolOutcome(outcome) { const target = operationScope.getStore(); if (target) target.toolOutcome = outcome; }