MCPcopy Index your code
hub / github.com/github/copilot-sdk / isToolResultObject

Function isToolResultObject

nodejs/src/session.ts:1395–1420  ·  view source on GitHub ↗

* Type guard that checks whether a value is a ToolResultObject. * A valid object must have a string `textResultForLlm` and a recognized `resultType`.

(value: unknown)

Source from the content-addressed store, hash-verified

1393 * A valid object must have a string `textResultForLlm` and a recognized `resultType`.
1394 */
1395function isToolResultObject(value: unknown): value is ToolResultObject {
1396 if (typeof value !== "object" || value === null) {
1397 return false;
1398 }
1399
1400 if (
1401 !("textResultForLlm" in value) ||
1402 typeof (value as ToolResultObject).textResultForLlm !== "string"
1403 ) {
1404 return false;
1405 }
1406
1407 if (!("resultType" in value) || typeof (value as ToolResultObject).resultType !== "string") {
1408 return false;
1409 }
1410
1411 const allowedResultTypes: Array<ToolResultObject["resultType"]> = [
1412 "success",
1413 "failure",
1414 "rejected",
1415 "denied",
1416 "timeout",
1417 ];
1418
1419 return allowedResultTypes.includes((value as ToolResultObject).resultType);
1420}
1421
1422/** Convert a canvas handler error into a ResponseError with a structured data envelope. */
1423function toCanvasRpcError(error: unknown): ResponseError<unknown> {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…