agent-pool-mcp 1.2.1 → 1.3.0
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/package.json +1 -1
- package/src/server.js +73 -1
- package/src/tool-definitions.js +20 -0
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
9
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
9
10
|
import {
|
|
10
11
|
ListToolsRequestSchema,
|
|
11
12
|
CallToolRequestSchema,
|
|
13
|
+
ListResourcesRequestSchema,
|
|
14
|
+
ReadResourceRequestSchema,
|
|
12
15
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
13
16
|
import { randomUUID } from 'node:crypto';
|
|
14
17
|
|
|
@@ -108,9 +111,33 @@ export function createServer() {
|
|
|
108
111
|
|
|
109
112
|
const server = new Server(
|
|
110
113
|
{ name: 'agent-pool', version: '1.2.1' },
|
|
111
|
-
{ capabilities: { tools: {} } },
|
|
114
|
+
{ capabilities: { tools: {}, resources: {} } },
|
|
112
115
|
);
|
|
113
116
|
|
|
117
|
+
server.setRequestHandler(ListResourcesRequestSchema, async () => ({
|
|
118
|
+
resources: [{
|
|
119
|
+
uri: 'agent-pool://guide',
|
|
120
|
+
name: 'Usage Guide',
|
|
121
|
+
description: 'Comprehensive guide for agent-pool',
|
|
122
|
+
mimeType: 'text/markdown',
|
|
123
|
+
}],
|
|
124
|
+
}));
|
|
125
|
+
|
|
126
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
127
|
+
if (request.params.uri === 'agent-pool://guide') {
|
|
128
|
+
const guidePath = path.resolve(__dirname, '..', 'GUIDE.md');
|
|
129
|
+
const content = fs.readFileSync(guidePath, 'utf-8');
|
|
130
|
+
return {
|
|
131
|
+
contents: [{
|
|
132
|
+
uri: request.params.uri,
|
|
133
|
+
mimeType: 'text/markdown',
|
|
134
|
+
text: content,
|
|
135
|
+
}],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
throw new Error(`Resource not found: ${request.params.uri}`);
|
|
139
|
+
});
|
|
140
|
+
|
|
114
141
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
115
142
|
tools: TOOL_DEFINITIONS,
|
|
116
143
|
}));
|
|
@@ -155,6 +182,8 @@ export function createServer() {
|
|
|
155
182
|
response = handleCancelSchedule(args); break;
|
|
156
183
|
case 'get_scheduled_results':
|
|
157
184
|
response = handleGetScheduledResults(args); break;
|
|
185
|
+
case 'get_usage_guide':
|
|
186
|
+
response = handleGetUsageGuide(args); break;
|
|
158
187
|
case 'create_pipeline':
|
|
159
188
|
response = handleCreatePipeline(args); break;
|
|
160
189
|
case 'run_pipeline':
|
|
@@ -169,6 +198,8 @@ export function createServer() {
|
|
|
169
198
|
response = handleSignalStepComplete(args); break;
|
|
170
199
|
case 'bounce_back':
|
|
171
200
|
response = handleBounceBack(args); break;
|
|
201
|
+
case 'get_usage_guide':
|
|
202
|
+
response = handleGetUsageGuide(args); break;
|
|
172
203
|
default:
|
|
173
204
|
response = { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
|
|
174
205
|
}
|
|
@@ -616,3 +647,44 @@ function handleBounceBack(args) {
|
|
|
616
647
|
}
|
|
617
648
|
}
|
|
618
649
|
|
|
650
|
+
/** @param {object} args */
|
|
651
|
+
function handleGetUsageGuide(args) {
|
|
652
|
+
const guidePath = path.resolve(__dirname, '..', 'GUIDE.md');
|
|
653
|
+
if (!fs.existsSync(guidePath)) {
|
|
654
|
+
return { content: [{ type: 'text', text: 'Guide not found.' }], isError: true };
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
const fullContent = fs.readFileSync(guidePath, 'utf-8');
|
|
658
|
+
|
|
659
|
+
if (!args.topic) {
|
|
660
|
+
return { content: [{ type: 'text', text: fullContent }] };
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
const topicLower = args.topic.toLowerCase();
|
|
664
|
+
const lines = fullContent.split('\n');
|
|
665
|
+
let inTopic = false;
|
|
666
|
+
let topicContent = [];
|
|
667
|
+
|
|
668
|
+
for (const line of lines) {
|
|
669
|
+
if (line.toLowerCase().startsWith(`## ${topicLower}`)) {
|
|
670
|
+
inTopic = true;
|
|
671
|
+
topicContent.push(line);
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
if (inTopic && line.startsWith('## ')) {
|
|
676
|
+
break; // End of section
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
if (inTopic) {
|
|
680
|
+
topicContent.push(line);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
if (topicContent.length === 0) {
|
|
685
|
+
return { content: [{ type: 'text', text: `Topic '${args.topic}' not found in the guide.\n\nAvailable topics: delegation, pipelines, scheduling, skills, peer-review, sessions.` }] };
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
return { content: [{ type: 'text', text: topicContent.join('\n').trim() }] };
|
|
689
|
+
}
|
|
690
|
+
|
package/src/tool-definitions.js
CHANGED
|
@@ -6,6 +6,26 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export const TOOL_DEFINITIONS = [
|
|
9
|
+
{
|
|
10
|
+
name: 'get_usage_guide',
|
|
11
|
+
description: [
|
|
12
|
+
'Get the comprehensive usage guide for agent-pool with examples and best practices.',
|
|
13
|
+
'Call this FIRST when planning how to use agent-pool tools for parallel work, pipelines, or scheduling.',
|
|
14
|
+
'Returns practical examples for each feature area.',
|
|
15
|
+
'',
|
|
16
|
+
'Available topics: delegation, pipelines, scheduling, skills, peer-review, sessions.',
|
|
17
|
+
'Omit topic to get the full guide.',
|
|
18
|
+
].join('\n'),
|
|
19
|
+
inputSchema: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
topic: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'Optional topic filter: delegation, pipelines, scheduling, skills, peer-review, sessions',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
9
29
|
{
|
|
10
30
|
name: 'delegate_task',
|
|
11
31
|
description: [
|