Skip to content

Commit f30cac4

Browse files
committed
make assignids not async
1 parent c85ca84 commit f30cac4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/McpContext.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,13 @@ export class McpContext implements Context {
330330
// will be used for the tree serialization and mapping ids back to nodes.
331331
let idCounter = 0;
332332
const idToNode = new Map<string, TextSnapshotNode>();
333-
const assignIds = async (
334-
node: SerializedAXNode,
335-
): Promise<TextSnapshotNode> => {
333+
const assignIds = (node: SerializedAXNode): TextSnapshotNode => {
336334
const nodeWithId: TextSnapshotNode = {
337335
...node,
338336
id: `${snapshotId}_${idCounter++}`,
339-
children: [],
337+
children: node.children
338+
? node.children.map(child => assignIds(child))
339+
: [],
340340
};
341341

342342
// The AXNode for an option doesn't contain its `value`.
@@ -348,10 +348,6 @@ export class McpContext implements Context {
348348
}
349349
}
350350

351-
nodeWithId.children = node.children
352-
? await Promise.all(node.children.map(child => assignIds(child)))
353-
: [];
354-
355351
idToNode.set(nodeWithId.id, nodeWithId);
356352
return nodeWithId;
357353
};

0 commit comments

Comments
 (0)