agent-desk-mcp 1.0.1 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +24 -6
- package/package.json +1 -1
- package/src/index.ts +26 -6
package/dist/index.js
CHANGED
|
@@ -50,8 +50,15 @@ class AgentDeskServer {
|
|
|
50
50
|
name: "agent-desk",
|
|
51
51
|
version: "1.0.0",
|
|
52
52
|
});
|
|
53
|
+
this.setupCapabilities();
|
|
53
54
|
this.setupHandlers();
|
|
54
55
|
}
|
|
56
|
+
setupCapabilities() {
|
|
57
|
+
const capabilities = {
|
|
58
|
+
tools: {},
|
|
59
|
+
};
|
|
60
|
+
this.server.registerCapabilities(capabilities);
|
|
61
|
+
}
|
|
55
62
|
setupHandlers() {
|
|
56
63
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
57
64
|
return {
|
|
@@ -63,7 +70,14 @@ class AgentDeskServer {
|
|
|
63
70
|
Arguments:
|
|
64
71
|
- agent_summary: Brief summary of your role/identity.
|
|
65
72
|
- context: Brief context (max 1000 chars) explaining why you are asking these questions.
|
|
66
|
-
- questions: List of questions
|
|
73
|
+
- questions: List of questions. Each question should have:
|
|
74
|
+
- id: Unique question identifier (recommended format: Q1, Q2, etc.)
|
|
75
|
+
- content: Question text
|
|
76
|
+
- options: Optional list of choices. Each option should have:
|
|
77
|
+
- value: The value to return if selected
|
|
78
|
+
- label: The display text for the option
|
|
79
|
+
Note: If a question has options, do NOT add an "Other" option manually.
|
|
80
|
+
The UI will automatically add an "Other" option with a text input field.
|
|
67
81
|
- timeout_seconds: Timeout in seconds. None means no timeout.
|
|
68
82
|
|
|
69
83
|
Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
@@ -76,7 +90,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
76
90
|
},
|
|
77
91
|
context: {
|
|
78
92
|
type: "string",
|
|
79
|
-
description: "Brief context explaining why you are asking these questions",
|
|
93
|
+
description: "Brief context (max 1000 chars) explaining why you are asking these questions",
|
|
80
94
|
},
|
|
81
95
|
questions: {
|
|
82
96
|
type: "array",
|
|
@@ -86,7 +100,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
86
100
|
properties: {
|
|
87
101
|
id: {
|
|
88
102
|
type: "string",
|
|
89
|
-
description: "Unique question identifier",
|
|
103
|
+
description: "Unique question identifier (recommended format: Q1, Q2, etc.)",
|
|
90
104
|
},
|
|
91
105
|
content: {
|
|
92
106
|
type: "string",
|
|
@@ -98,8 +112,8 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
98
112
|
items: {
|
|
99
113
|
type: "object",
|
|
100
114
|
properties: {
|
|
101
|
-
value: { type: "string" },
|
|
102
|
-
label: { type: "string" },
|
|
115
|
+
value: { type: "string", description: "The value to return if selected" },
|
|
116
|
+
label: { type: "string", description: "The display text for the option" },
|
|
103
117
|
},
|
|
104
118
|
},
|
|
105
119
|
},
|
|
@@ -109,7 +123,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
109
123
|
},
|
|
110
124
|
timeout_seconds: {
|
|
111
125
|
type: "number",
|
|
112
|
-
description: "Timeout in seconds",
|
|
126
|
+
description: "Timeout in seconds. None means no timeout",
|
|
113
127
|
},
|
|
114
128
|
},
|
|
115
129
|
required: ["agent_summary", "context", "questions"],
|
|
@@ -136,6 +150,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
136
150
|
async handleAskUser(args) {
|
|
137
151
|
const { agent_summary, context, questions, timeout_seconds, } = args;
|
|
138
152
|
const sessionId = crypto.randomUUID();
|
|
153
|
+
console.error(`[${new Date().toISOString()}] START handleAskUser: ${sessionId} - ${agent_summary}`);
|
|
139
154
|
// Ensure questions have IDs
|
|
140
155
|
const processedQuestions = questions.map((q, i) => ({
|
|
141
156
|
...q,
|
|
@@ -148,6 +163,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
148
163
|
while (true) {
|
|
149
164
|
// Check timeout
|
|
150
165
|
if (timeout_seconds && (Date.now() - startTime) >= timeout_seconds * 1000) {
|
|
166
|
+
console.error(`[${new Date().toISOString()}] TIMEOUT handleAskUser: ${sessionId}`);
|
|
151
167
|
return {
|
|
152
168
|
content: [
|
|
153
169
|
{
|
|
@@ -160,6 +176,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
160
176
|
// Check for answer
|
|
161
177
|
const agent = await this.apiClient.getAgent(sessionId);
|
|
162
178
|
if (agent && agent.status === "answered") {
|
|
179
|
+
console.error(`[${new Date().toISOString()}] ANSWERED handleAskUser: ${sessionId}`);
|
|
163
180
|
const answers = agent.questions
|
|
164
181
|
.filter((q) => q.answer)
|
|
165
182
|
.map((q) => `${q.id}: ${q.answer}`);
|
|
@@ -172,6 +189,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
172
189
|
],
|
|
173
190
|
};
|
|
174
191
|
}
|
|
192
|
+
console.error(`[${new Date().toISOString()}] POLLING handleAskUser: ${sessionId}`);
|
|
175
193
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
176
194
|
}
|
|
177
195
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
3
3
|
import {
|
|
4
4
|
CallToolRequestSchema,
|
|
5
5
|
ListToolsRequestSchema,
|
|
6
|
+
ServerCapabilities,
|
|
6
7
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
7
8
|
import axios, { AxiosInstance } from "axios";
|
|
8
9
|
|
|
@@ -79,9 +80,17 @@ class AgentDeskServer {
|
|
|
79
80
|
name: "agent-desk",
|
|
80
81
|
version: "1.0.0",
|
|
81
82
|
});
|
|
83
|
+
this.setupCapabilities();
|
|
82
84
|
this.setupHandlers();
|
|
83
85
|
}
|
|
84
86
|
|
|
87
|
+
private setupCapabilities(): void {
|
|
88
|
+
const capabilities: ServerCapabilities = {
|
|
89
|
+
tools: {},
|
|
90
|
+
};
|
|
91
|
+
this.server.registerCapabilities(capabilities);
|
|
92
|
+
}
|
|
93
|
+
|
|
85
94
|
private setupHandlers(): void {
|
|
86
95
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
87
96
|
return {
|
|
@@ -93,7 +102,14 @@ class AgentDeskServer {
|
|
|
93
102
|
Arguments:
|
|
94
103
|
- agent_summary: Brief summary of your role/identity.
|
|
95
104
|
- context: Brief context (max 1000 chars) explaining why you are asking these questions.
|
|
96
|
-
- questions: List of questions
|
|
105
|
+
- questions: List of questions. Each question should have:
|
|
106
|
+
- id: Unique question identifier (recommended format: Q1, Q2, etc.)
|
|
107
|
+
- content: Question text
|
|
108
|
+
- options: Optional list of choices. Each option should have:
|
|
109
|
+
- value: The value to return if selected
|
|
110
|
+
- label: The display text for the option
|
|
111
|
+
Note: If a question has options, do NOT add an "Other" option manually.
|
|
112
|
+
The UI will automatically add an "Other" option with a text input field.
|
|
97
113
|
- timeout_seconds: Timeout in seconds. None means no timeout.
|
|
98
114
|
|
|
99
115
|
Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
@@ -106,7 +122,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
106
122
|
},
|
|
107
123
|
context: {
|
|
108
124
|
type: "string",
|
|
109
|
-
description: "Brief context explaining why you are asking these questions",
|
|
125
|
+
description: "Brief context (max 1000 chars) explaining why you are asking these questions",
|
|
110
126
|
},
|
|
111
127
|
questions: {
|
|
112
128
|
type: "array",
|
|
@@ -116,7 +132,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
116
132
|
properties: {
|
|
117
133
|
id: {
|
|
118
134
|
type: "string",
|
|
119
|
-
description: "Unique question identifier",
|
|
135
|
+
description: "Unique question identifier (recommended format: Q1, Q2, etc.)",
|
|
120
136
|
},
|
|
121
137
|
content: {
|
|
122
138
|
type: "string",
|
|
@@ -128,8 +144,8 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
128
144
|
items: {
|
|
129
145
|
type: "object",
|
|
130
146
|
properties: {
|
|
131
|
-
value: { type: "string" },
|
|
132
|
-
label: { type: "string" },
|
|
147
|
+
value: { type: "string", description: "The value to return if selected" },
|
|
148
|
+
label: { type: "string", description: "The display text for the option" },
|
|
133
149
|
},
|
|
134
150
|
},
|
|
135
151
|
},
|
|
@@ -139,7 +155,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
139
155
|
},
|
|
140
156
|
timeout_seconds: {
|
|
141
157
|
type: "number",
|
|
142
|
-
description: "Timeout in seconds",
|
|
158
|
+
description: "Timeout in seconds. None means no timeout",
|
|
143
159
|
},
|
|
144
160
|
},
|
|
145
161
|
required: ["agent_summary", "context", "questions"],
|
|
@@ -183,6 +199,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
183
199
|
};
|
|
184
200
|
|
|
185
201
|
const sessionId = crypto.randomUUID();
|
|
202
|
+
console.error(`[${new Date().toISOString()}] START handleAskUser: ${sessionId} - ${agent_summary}`);
|
|
186
203
|
|
|
187
204
|
// Ensure questions have IDs
|
|
188
205
|
const processedQuestions = questions.map((q, i) => ({
|
|
@@ -205,6 +222,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
205
222
|
while (true) {
|
|
206
223
|
// Check timeout
|
|
207
224
|
if (timeout_seconds && (Date.now() - startTime) >= timeout_seconds * 1000) {
|
|
225
|
+
console.error(`[${new Date().toISOString()}] TIMEOUT handleAskUser: ${sessionId}`);
|
|
208
226
|
return {
|
|
209
227
|
content: [
|
|
210
228
|
{
|
|
@@ -218,6 +236,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
218
236
|
// Check for answer
|
|
219
237
|
const agent = await this.apiClient!.getAgent(sessionId);
|
|
220
238
|
if (agent && agent.status === "answered") {
|
|
239
|
+
console.error(`[${new Date().toISOString()}] ANSWERED handleAskUser: ${sessionId}`);
|
|
221
240
|
const answers = agent.questions
|
|
222
241
|
.filter((q) => q.answer)
|
|
223
242
|
.map((q) => `${q.id}: ${q.answer}`);
|
|
@@ -231,6 +250,7 @@ Returns: User's answers concatenated with newlines, or timeout message.`,
|
|
|
231
250
|
};
|
|
232
251
|
}
|
|
233
252
|
|
|
253
|
+
console.error(`[${new Date().toISOString()}] POLLING handleAskUser: ${sessionId}`);
|
|
234
254
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
235
255
|
}
|
|
236
256
|
}
|