mcp-sequential-research 1.0.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/README.md +251 -0
- package/dist/compilers.d.ts +12 -0
- package/dist/compilers.d.ts.map +1 -0
- package/dist/compilers.js +871 -0
- package/dist/compilers.js.map +1 -0
- package/dist/format.d.ts +84 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +177 -0
- package/dist/format.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +251 -0
- package/dist/index.js.map +1 -0
- package/dist/planners.d.ts +12 -0
- package/dist/planners.d.ts.map +1 -0
- package/dist/planners.js +608 -0
- package/dist/planners.js.map +1 -0
- package/dist/schema.d.ts +1947 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +232 -0
- package/dist/schema.js.map +1 -0
- package/docs/MCP_GUIDANCE.md +409 -0
- package/docs/TOOL_CONTRACTS.md +431 -0
- package/examples/example_workflow.md +464 -0
- package/package.json +38 -0
- package/src/compilers.ts +1113 -0
- package/src/format.ts +219 -0
- package/src/index.ts +270 -0
- package/src/planners.ts +687 -0
- package/src/schema.ts +303 -0
- package/tsconfig.json +24 -0
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
# Tool Contracts
|
|
2
|
+
|
|
3
|
+
This document provides JSON examples for testing both tools without Claude. Use these for regression testing and schema validation.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [sequential_research_plan](#sequential_research_plan)
|
|
8
|
+
- [sequential_research_compile](#sequential_research_compile)
|
|
9
|
+
- [raw_results Schema](#raw_results-schema)
|
|
10
|
+
- [Minimum Viable Test Data](#minimum-viable-test-data)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## sequential_research_plan
|
|
15
|
+
|
|
16
|
+
### Input Schema
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"topic": "string (required)",
|
|
21
|
+
"depth": "shallow | standard | deep (default: standard)",
|
|
22
|
+
"focus_areas": ["string array (optional)"],
|
|
23
|
+
"constraints": ["string array (optional)"],
|
|
24
|
+
"output_format": "markdown | json | structured (default: markdown)"
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Example Input
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"topic": "photonic neural network accelerators",
|
|
33
|
+
"depth": "standard",
|
|
34
|
+
"focus_areas": ["silicon photonics", "energy efficiency"],
|
|
35
|
+
"constraints": ["patent-focused", "post-2020"]
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Example Output
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"plan_id": "plan-m1abc2def-x9y8z7",
|
|
44
|
+
"topic": "photonic neural network accelerators",
|
|
45
|
+
"created_at": "2025-01-13T10:30:00.000Z",
|
|
46
|
+
"summary": "Research plan for \"photonic neural network accelerators\" with 7 queries at standard depth. Focus areas: silicon photonics, energy efficiency. Execution in 3 phases.",
|
|
47
|
+
"queries": [
|
|
48
|
+
{
|
|
49
|
+
"query_id": "q1",
|
|
50
|
+
"query_text": "What is photonic neural network accelerators",
|
|
51
|
+
"query_type": "definition",
|
|
52
|
+
"extraction_goals": [
|
|
53
|
+
"Primary definition",
|
|
54
|
+
"Key characteristics",
|
|
55
|
+
"Common examples",
|
|
56
|
+
"Related terminology"
|
|
57
|
+
],
|
|
58
|
+
"priority": "critical"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"query_id": "q2",
|
|
62
|
+
"query_text": "Current state of photonic neural network accelerators",
|
|
63
|
+
"query_type": "current_state",
|
|
64
|
+
"extraction_goals": [
|
|
65
|
+
"Current status",
|
|
66
|
+
"Recent developments",
|
|
67
|
+
"Key players or stakeholders",
|
|
68
|
+
"Trends"
|
|
69
|
+
],
|
|
70
|
+
"priority": "critical",
|
|
71
|
+
"depends_on": ["q1"]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"query_id": "q3",
|
|
75
|
+
"query_text": "Compare photonic neural network accelerators",
|
|
76
|
+
"query_type": "comparison",
|
|
77
|
+
"extraction_goals": [
|
|
78
|
+
"Key similarities",
|
|
79
|
+
"Key differences",
|
|
80
|
+
"Trade-offs",
|
|
81
|
+
"Use case recommendations"
|
|
82
|
+
],
|
|
83
|
+
"priority": "medium",
|
|
84
|
+
"depends_on": ["q1"]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"query_id": "q4",
|
|
88
|
+
"query_text": "photonic neural network accelerators: silicon photonics",
|
|
89
|
+
"query_type": "current_state",
|
|
90
|
+
"extraction_goals": [
|
|
91
|
+
"Current state of silicon photonics",
|
|
92
|
+
"Key developments in silicon photonics",
|
|
93
|
+
"Challenges and opportunities"
|
|
94
|
+
],
|
|
95
|
+
"priority": "high",
|
|
96
|
+
"depends_on": ["q1"]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"query_id": "q5",
|
|
100
|
+
"query_text": "photonic neural network accelerators: energy efficiency",
|
|
101
|
+
"query_type": "current_state",
|
|
102
|
+
"extraction_goals": [
|
|
103
|
+
"Current state of energy efficiency",
|
|
104
|
+
"Key developments in energy efficiency",
|
|
105
|
+
"Challenges and opportunities"
|
|
106
|
+
],
|
|
107
|
+
"priority": "high",
|
|
108
|
+
"depends_on": ["q1"]
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
"result_schemas": [
|
|
112
|
+
{
|
|
113
|
+
"query_id": "q1",
|
|
114
|
+
"required_fields": [
|
|
115
|
+
{"field_name": "definition", "field_type": "string", "description": "Core definition", "required": true},
|
|
116
|
+
{"field_name": "characteristics", "field_type": "array", "description": "Key characteristics", "required": true},
|
|
117
|
+
{"field_name": "examples", "field_type": "array", "description": "Illustrative examples", "required": true}
|
|
118
|
+
],
|
|
119
|
+
"example": {
|
|
120
|
+
"definition": "Example value",
|
|
121
|
+
"characteristics": ["example1", "example2"],
|
|
122
|
+
"examples": ["example1", "example2"]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"execution_order": [
|
|
127
|
+
["q1"],
|
|
128
|
+
["q2", "q3", "q4", "q5"]
|
|
129
|
+
],
|
|
130
|
+
"estimated_sources": 15,
|
|
131
|
+
"metadata": {
|
|
132
|
+
"depth": "standard",
|
|
133
|
+
"focus_areas": ["silicon photonics", "energy efficiency"],
|
|
134
|
+
"constraints": ["patent-focused", "post-2020"],
|
|
135
|
+
"output_format": "markdown"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## sequential_research_compile
|
|
143
|
+
|
|
144
|
+
### Input Schema
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"plan": "PlanOutput object (required)",
|
|
149
|
+
"raw_results": "RawResult[] (required)",
|
|
150
|
+
"include_sources": "boolean (default: true)",
|
|
151
|
+
"include_methodology": "boolean (default: false)",
|
|
152
|
+
"citation_style": "inline | footnote | endnote (default: inline)"
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Example Input
|
|
157
|
+
|
|
158
|
+
See [Minimum Viable Test Data](#minimum-viable-test-data) below for a complete example.
|
|
159
|
+
|
|
160
|
+
### Example Output
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"report_id": "report-n2bcd3efg-a1b2c3",
|
|
165
|
+
"plan_id": "plan-m1abc2def-x9y8z7",
|
|
166
|
+
"title": "Research Report: photonic neural network accelerators",
|
|
167
|
+
"compiled_at": "2025-01-13T10:35:00.000Z",
|
|
168
|
+
"executive_summary": "This report presents research findings on **photonic neural network accelerators**. The analysis covers 5 research queries across 4 sections. Key topics include: Overview, Current State, Comparison, Types and Categories.",
|
|
169
|
+
"sections": [
|
|
170
|
+
{
|
|
171
|
+
"heading": "Overview",
|
|
172
|
+
"level": 2,
|
|
173
|
+
"content": "Photonic neural network accelerators use optical signals... [1]\n\n**Key Characteristics:**\n- Low latency\n- High bandwidth\n- Energy efficient",
|
|
174
|
+
"citations_used": ["[1]"]
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"markdown_report": "# Research Report: photonic neural network accelerators\n\n## Executive Summary\n\nThis report presents research findings...\n\n## Overview\n\nPhotonic neural network accelerators use optical signals... [1]\n\n---\n\n### References\n\n- **[1]**: US Patent 11,123,456 <https://patents.google.com/patent/US11123456>",
|
|
178
|
+
"sources": [
|
|
179
|
+
{
|
|
180
|
+
"id": "[1]",
|
|
181
|
+
"source_type": "document",
|
|
182
|
+
"title": "US Patent 11,123,456",
|
|
183
|
+
"url": "https://patents.google.com/patent/US11123456"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"statistics": {
|
|
187
|
+
"queries_executed": 5,
|
|
188
|
+
"queries_succeeded": 5,
|
|
189
|
+
"queries_failed": 0,
|
|
190
|
+
"total_sources": 6,
|
|
191
|
+
"word_count": 450
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## raw_results Schema
|
|
199
|
+
|
|
200
|
+
Each element in the `raw_results` array must conform to this schema:
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
interface RawResult {
|
|
204
|
+
// Required
|
|
205
|
+
query_id: string; // Must match a query_id from the plan
|
|
206
|
+
success: boolean; // Whether execution succeeded
|
|
207
|
+
|
|
208
|
+
// Optional (required if success=true)
|
|
209
|
+
data?: {
|
|
210
|
+
[key: string]: unknown; // Must match the result_schema for this query
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// Optional
|
|
214
|
+
sources?: Citation[]; // Sources consulted
|
|
215
|
+
error?: string; // Error message if success=false
|
|
216
|
+
execution_notes?: string; // Notes about execution
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
interface Citation {
|
|
220
|
+
id: string; // e.g., "S1", "S2"
|
|
221
|
+
source_type: "web" | "document" | "api" | "database" | "manual";
|
|
222
|
+
title: string;
|
|
223
|
+
url?: string;
|
|
224
|
+
accessed_date?: string; // ISO date
|
|
225
|
+
excerpt?: string; // Relevant quote
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Validation Rules
|
|
230
|
+
|
|
231
|
+
1. `query_id` must exist in `plan.queries`
|
|
232
|
+
2. If `success=true`, `data` should be populated
|
|
233
|
+
3. If `success=false`, `error` should explain why
|
|
234
|
+
4. `sources[].id` should be unique within results
|
|
235
|
+
5. `sources[].id` format: `S1`, `S2`, etc. (gets renumbered to `[1]`, `[2]` in output)
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Minimum Viable Test Data
|
|
240
|
+
|
|
241
|
+
Use this data set for regression testing. It includes 3 patents + 3 web sources.
|
|
242
|
+
|
|
243
|
+
### Test Plan Input
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"topic": "optical matrix multiplication",
|
|
248
|
+
"depth": "shallow",
|
|
249
|
+
"focus_areas": ["photonic tensor cores"],
|
|
250
|
+
"output_format": "markdown"
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Test Raw Results (3 patents + 3 web)
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
[
|
|
258
|
+
{
|
|
259
|
+
"query_id": "q1",
|
|
260
|
+
"success": true,
|
|
261
|
+
"data": {
|
|
262
|
+
"definition": "Optical matrix multiplication performs linear algebra operations using photons instead of electrons, enabling parallel computation at the speed of light.",
|
|
263
|
+
"characteristics": [
|
|
264
|
+
"Parallel processing of matrix elements",
|
|
265
|
+
"Low power consumption",
|
|
266
|
+
"High bandwidth",
|
|
267
|
+
"Wavelength division multiplexing"
|
|
268
|
+
],
|
|
269
|
+
"examples": [
|
|
270
|
+
"Mach-Zehnder interferometer arrays",
|
|
271
|
+
"Photonic tensor cores",
|
|
272
|
+
"Optical dot product engines"
|
|
273
|
+
]
|
|
274
|
+
},
|
|
275
|
+
"sources": [
|
|
276
|
+
{
|
|
277
|
+
"id": "S1",
|
|
278
|
+
"source_type": "document",
|
|
279
|
+
"title": "US11123456B2 - Optical matrix multiplication system",
|
|
280
|
+
"url": "https://patents.google.com/patent/US11123456B2",
|
|
281
|
+
"accessed_date": "2025-01-13",
|
|
282
|
+
"excerpt": "A system for performing matrix multiplication using coherent optical signals..."
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"id": "S2",
|
|
286
|
+
"source_type": "web",
|
|
287
|
+
"title": "Introduction to Photonic Computing - MIT",
|
|
288
|
+
"url": "https://example.mit.edu/photonic-computing-intro",
|
|
289
|
+
"accessed_date": "2025-01-13"
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"query_id": "q2",
|
|
295
|
+
"success": true,
|
|
296
|
+
"data": {
|
|
297
|
+
"current_status": "Optical matrix multiplication is transitioning from research to early commercialization, with several startups demonstrating prototype systems.",
|
|
298
|
+
"recent_developments": [
|
|
299
|
+
"Lightmatter announced Envise chip (2024)",
|
|
300
|
+
"Intel demonstrated silicon photonics integration",
|
|
301
|
+
"NVIDIA exploring hybrid optical-electronic accelerators"
|
|
302
|
+
],
|
|
303
|
+
"key_players": [
|
|
304
|
+
"Lightmatter",
|
|
305
|
+
"Luminous Computing",
|
|
306
|
+
"Intel Silicon Photonics",
|
|
307
|
+
"MIT Photonics Lab"
|
|
308
|
+
]
|
|
309
|
+
},
|
|
310
|
+
"sources": [
|
|
311
|
+
{
|
|
312
|
+
"id": "S3",
|
|
313
|
+
"source_type": "document",
|
|
314
|
+
"title": "US20240001234A1 - Integrated photonic tensor processor",
|
|
315
|
+
"url": "https://patents.google.com/patent/US20240001234A1",
|
|
316
|
+
"accessed_date": "2025-01-13",
|
|
317
|
+
"excerpt": "An integrated photonic processor comprising multiple tensor cores..."
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"id": "S4",
|
|
321
|
+
"source_type": "web",
|
|
322
|
+
"title": "Lightmatter Envise Technical Overview",
|
|
323
|
+
"url": "https://lightmatter.co/envise",
|
|
324
|
+
"accessed_date": "2025-01-13"
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"query_id": "q3",
|
|
330
|
+
"success": true,
|
|
331
|
+
"data": {
|
|
332
|
+
"items": [
|
|
333
|
+
"Free-space optical systems",
|
|
334
|
+
"Integrated photonic circuits",
|
|
335
|
+
"Hybrid electro-optical systems",
|
|
336
|
+
"Wavelength-multiplexed arrays"
|
|
337
|
+
],
|
|
338
|
+
"categories": {
|
|
339
|
+
"Architecture": ["Free-space", "Integrated", "Hybrid"],
|
|
340
|
+
"Technology": ["Silicon photonics", "III-V compounds", "Polymer waveguides"]
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
"sources": [
|
|
344
|
+
{
|
|
345
|
+
"id": "S5",
|
|
346
|
+
"source_type": "document",
|
|
347
|
+
"title": "EP3987654A1 - Wavelength-multiplexed optical computing",
|
|
348
|
+
"url": "https://patents.google.com/patent/EP3987654A1",
|
|
349
|
+
"accessed_date": "2025-01-13",
|
|
350
|
+
"excerpt": "A wavelength-multiplexed optical computing architecture..."
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"id": "S6",
|
|
354
|
+
"source_type": "web",
|
|
355
|
+
"title": "Survey of Optical Computing Architectures - Nature",
|
|
356
|
+
"url": "https://nature.com/articles/optical-computing-survey",
|
|
357
|
+
"accessed_date": "2025-01-13"
|
|
358
|
+
}
|
|
359
|
+
]
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Expected Compile Output Statistics
|
|
365
|
+
|
|
366
|
+
```json
|
|
367
|
+
{
|
|
368
|
+
"queries_executed": 3,
|
|
369
|
+
"queries_succeeded": 3,
|
|
370
|
+
"queries_failed": 0,
|
|
371
|
+
"total_sources": 6,
|
|
372
|
+
"word_count": 300
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Testing Commands
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
# Start the server
|
|
380
|
+
npm run dev
|
|
381
|
+
|
|
382
|
+
# In another terminal, send test requests via stdio
|
|
383
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | npm run dev
|
|
384
|
+
|
|
385
|
+
# Or use the MCP inspector
|
|
386
|
+
npx @anthropic/mcp-inspector
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
## Error Cases to Test
|
|
392
|
+
|
|
393
|
+
### 1. Missing Required Field
|
|
394
|
+
|
|
395
|
+
```json
|
|
396
|
+
{
|
|
397
|
+
"depth": "standard"
|
|
398
|
+
}
|
|
399
|
+
```
|
|
400
|
+
Expected: Validation error for missing `topic`
|
|
401
|
+
|
|
402
|
+
### 2. Invalid Enum Value
|
|
403
|
+
|
|
404
|
+
```json
|
|
405
|
+
{
|
|
406
|
+
"topic": "test",
|
|
407
|
+
"depth": "ultra-deep"
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
Expected: Validation error for invalid `depth`
|
|
411
|
+
|
|
412
|
+
### 3. Failed Query in Results
|
|
413
|
+
|
|
414
|
+
```json
|
|
415
|
+
{
|
|
416
|
+
"query_id": "q1",
|
|
417
|
+
"success": false,
|
|
418
|
+
"error": "API rate limit exceeded"
|
|
419
|
+
}
|
|
420
|
+
```
|
|
421
|
+
Expected: Warning in output, query skipped in report
|
|
422
|
+
|
|
423
|
+
### 4. Empty Results Array
|
|
424
|
+
|
|
425
|
+
```json
|
|
426
|
+
{
|
|
427
|
+
"plan": { ... },
|
|
428
|
+
"raw_results": []
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
Expected: Empty report with 0 sources, warning about no data
|