MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / executeOutcomeAttributes

Function executeOutcomeAttributes

packages/core/execution/src/engine.ts:96–112  ·  view source on GitHub ↗
(result: ExecuteResult)

Source from the content-addressed store, hash-verified

94const executeOutcomeAttributesCache = new WeakMap<ExecuteResult, Record<string, unknown>>();
95
96const executeOutcomeAttributes = (result: ExecuteResult): Record<string, unknown> => {
97 const cached = executeOutcomeAttributesCache.get(result);
98 if (cached) return cached;
99 const attributes = {
100 "mcp.execute.result_chars": measureResultChars(result.result),
101 "mcp.execute.log_chars": result.logs?.reduce((total, line) => total + line.length, 0) ?? 0,
102 "mcp.execute.emitted": result.output?.length ?? 0,
103 ...(result.error
104 ? {
105 "mcp.execute.outcome": "fail",
106 "mcp.execute.error_kind": result.errorKind ?? "unknown",
107 }
108 : { "mcp.execute.outcome": "ok" }),
109 };
110 executeOutcomeAttributesCache.set(result, attributes);
111 return attributes;
112};
113
114/**
115 * Stamp the current `mcp.execute` / `mcp.execute.resume` span with how the

Callers 1

annotateExecuteOutcomeFunction · 0.85

Calls 3

measureResultCharsFunction · 0.85
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected