import type { McpAppCallToolResult, McpAppModelContext, McpAppViewDetail, McpAppViewSummary, ToolCallProgressSnapshot } from "@paperclipai/shared"; import { api } from "./client"; /** MCP Apps views recorded for a task's tool calls. */ export const mcpAppsApi = { list: (issueId: string) => api.get(`/issues/${issueId}/mcp-app-views`, { cache: "no-store" }), detail: (issueId: string, viewId: string, signal?: AbortSignal) => api.get(`/issues/${issueId}/mcp-app-views/${viewId}`, { cache: "no-store", signal }), callTool: (issueId: string, viewId: string, name: string, args: Record) => api.post(`/issues/${issueId}/mcp-app-views/${viewId}/tool-calls`, { name, arguments: args }), /** Stores the view's latest context for the task's next run; null clears it. */ updateModelContext: (issueId: string, viewId: string, context: McpAppModelContext | null) => api.put<{ updated: boolean }>(`/issues/${issueId}/mcp-app-views/${viewId}/model-context`, context ? { ...(context.text ? { content: [{ type: "text", text: context.text }] } : {}), ...(context.structuredContent ? { structuredContent: context.structuredContent } : {}) } : {}), /** Records that the viewer sent a view's proposed message (sent with this client request id). */ messageSent: (issueId: string, viewId: string, clientRequestId: string) => api.post<{ commentId: string }>(`/issues/${issueId}/mcp-app-views/${viewId}/messages`, { clientRequestId }), /** The latest progress of the task's running app tool calls (for a reload mid-call). */ toolCallProgress: (issueId: string) => api.get(`/issues/${issueId}/tool-call-progress`, { cache: "no-store" }), };