MCPcopy Create free account
hub / github.com/modelcontextprotocol/ext-apps / enqueueCommand

Function enqueueCommand

examples/pdf-server/server.ts:420–436  ·  view source on GitHub ↗
(viewUUID: string, command: PdfCommand)

Source from the content-addressed store, hash-verified

418setInterval(pruneStaleQueues, SWEEP_INTERVAL_MS).unref();
419
420function enqueueCommand(viewUUID: string, command: PdfCommand): void {
421 let entry = commandQueues.get(viewUUID);
422 if (!entry) {
423 entry = { commands: [], lastActivity: Date.now() };
424 commandQueues.set(viewUUID, entry);
425 }
426 entry.commands.push(command);
427 entry.lastActivity = Date.now();
428 touchView(viewUUID);
429
430 // Wake up any long-polling request waiting for this viewUUID
431 const waiter = pollWaiters.get(viewUUID);
432 if (waiter) {
433 pollWaiters.delete(viewUUID);
434 waiter();
435 }
436}
437
438function dequeueCommands(viewUUID: string): PdfCommand[] {
439 // Poll is activity — keep the view alive even when the queue is empty

Callers 3

onEventFunction · 0.85
createServerFunction · 0.85
processInteractCommandFunction · 0.85

Calls 1

touchViewFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…