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

Function executeOutcomeAttributes

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

Source from the content-addressed store, hash-verified

92const executeOutcomeAttributesCache = new WeakMap<ExecuteResult, Record<string, unknown>>();
93
94const executeOutcomeAttributes = (result: ExecuteResult): Record<string, unknown> => {
95 const cached = executeOutcomeAttributesCache.get(result);
96 if (cached) return cached;
97 const attributes = {
98 "mcp.execute.result_chars": measureResultChars(result.result),
99 "mcp.execute.log_chars": result.logs?.reduce((total, line) => total + line.length, 0) ?? 0,
100 "mcp.execute.emitted": result.output?.length ?? 0,
101 ...(result.error
102 ? { "mcp.execute.outcome": "fail", "mcp.execute.error_kind": result.errorKind ?? "unknown" }
103 : { "mcp.execute.outcome": "ok" }),
104 };
105 executeOutcomeAttributesCache.set(result, attributes);
106 return attributes;
107};
108
109/**
110 * 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