@@ -42,40 +42,7 @@ function getPrincipal(payload: { scope?: unknown; sub?: string }): McpPrincipal
4242 } ;
4343}
4444
45- async function confirmDelete (
46- server : ReturnType < typeof openApiMcpServer > ,
47- requestId : string | number ,
48- ) {
49- if ( ! server . server . getClientCapabilities ( ) ?. elicitation ) {
50- throw new Error ( "This MCP client must support elicitation before deleting workspace items." ) ;
51- }
52-
53- const result = await server . server . elicitInput (
54- {
55- mode : "form" ,
56- message : "Confirm deletion of the requested ThinkEx workspace items." ,
57- requestedSchema : {
58- type : "object" ,
59- properties : {
60- confirm : {
61- type : "boolean" ,
62- title : "Delete workspace items" ,
63- description : "This action cannot be undone." ,
64- } ,
65- } ,
66- required : [ "confirm" ] ,
67- } ,
68- } ,
69- { relatedRequestId : requestId } ,
70- ) ;
71-
72- if ( result . action !== "accept" || result . content ?. confirm !== true ) {
73- throw new Error ( "Workspace deletion was not confirmed." ) ;
74- }
75- }
76-
7745function createThinkExMcpServer ( env : Cloudflare . Env , principal : McpPrincipal ) {
78- const holder : { server ?: ReturnType < typeof openApiMcpServer > } = { } ;
7946 const server = openApiMcpServer ( {
8047 name : "ThinkEx" ,
8148 version : "1.0.0" ,
@@ -98,16 +65,6 @@ function createThinkExMcpServer(env: Cloudflare.Env, principal: McpPrincipal) {
9865 throw new Error ( "Unknown MCP operation." ) ;
9966 }
10067
101- if ( operation . name === "workspace_delete_items" ) {
102- const activeServer = holder . server ;
103-
104- if ( ! activeServer ) {
105- throw new Error ( "MCP server is not ready." ) ;
106- }
107-
108- await confirmDelete ( activeServer , context . requestId ) ;
109- }
110-
11168 return await executeMcpOperation ( {
11269 name : operationName ,
11370 body : options . body ,
@@ -117,7 +74,6 @@ function createThinkExMcpServer(env: Cloudflare.Env, principal: McpPrincipal) {
11774 } ,
11875 } ) ;
11976
120- holder . server = server ;
12177 return server ;
12278}
12379
0 commit comments