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

Function processInteractCommand

examples/pdf-server/server.ts:1946–2376  ·  view source on GitHub ↗

Process a single interact command. Returns content parts and an isError flag.

(
      uuid: string,
      cmd: InteractCommand,
      signal?: AbortSignal,
    )

Source from the content-addressed store, hash-verified

1944
1945 /** Process a single interact command. Returns content parts and an isError flag. */
1946 async function processInteractCommand(
1947 uuid: string,
1948 cmd: InteractCommand,
1949 signal?: AbortSignal,
1950 ): Promise<{ content: ContentPart[]; isError?: boolean }> {
1951 const {
1952 action,
1953 page,
1954 query,
1955 matchIndex,
1956 scale,
1957 annotations,
1958 ids,
1959 color,
1960 content,
1961 fields,
1962 intervals,
1963 path: savePath,
1964 overwrite,
1965 } = cmd;
1966
1967 let description: string;
1968 switch (action) {
1969 case "navigate":
1970 if (page == null)
1971 return {
1972 content: [{ type: "text", text: "navigate requires `page`" }],
1973 isError: true,
1974 };
1975 enqueueCommand(uuid, { type: "navigate", page });
1976 description = `navigate to page ${page}`;
1977 break;
1978 case "search":
1979 if (!query)
1980 return {
1981 content: [{ type: "text", text: "search requires `query`" }],
1982 isError: true,
1983 };
1984 enqueueCommand(uuid, { type: "search", query });
1985 description = `search for "${query}"`;
1986 break;
1987 case "find":
1988 if (!query)
1989 return {
1990 content: [{ type: "text", text: "find requires `query`" }],
1991 isError: true,
1992 };
1993 enqueueCommand(uuid, { type: "find", query });
1994 description = `find "${query}" (silent)`;
1995 break;
1996 case "search_navigate":
1997 if (matchIndex == null)
1998 return {
1999 content: [
2000 {
2001 type: "text",
2002 text: "search_navigate requires `matchIndex`",
2003 },

Callers 1

createServerFunction · 0.85

Calls 11

enqueueCommandFunction · 0.85
resolveImageAnnotationFunction · 0.85
ensureViewerIsPollingFunction · 0.85
waitForPageDataFunction · 0.85
isFileUrlFunction · 0.85
fileUrlToPathFunction · 0.85
isLocalPathFunction · 0.85
saveErrFunction · 0.85
isWritablePathFunction · 0.85
waitForSaveDataFunction · 0.85
waitForViewerStateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…