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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAazB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAMtD;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;EAc1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0C9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASpC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmB3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASd,CAAC"}
package/dist/schema.js ADDED
@@ -0,0 +1,232 @@
1
+ /**
2
+ * Zod schemas for MCP Sequential Research tools
3
+ *
4
+ * Defines input/output validation for:
5
+ * - sequential_research_plan
6
+ * - sequential_research_compile
7
+ */
8
+ import { z } from "zod";
9
+ // ============================================================================
10
+ // Common Schemas
11
+ // ============================================================================
12
+ /**
13
+ * Citation reference for tracking source provenance
14
+ */
15
+ export const CitationSchema = z.object({
16
+ id: z.string().describe("Unique citation identifier (e.g., [1], [src-001])"),
17
+ source_type: z.enum(["web", "document", "api", "database", "manual", "patent"]).describe("Type of source"),
18
+ title: z.string().describe("Title or name of the source"),
19
+ url: z.string().optional().describe("URL if applicable"),
20
+ accessed_date: z.string().optional().describe("ISO date when source was accessed"),
21
+ excerpt: z.string().optional().describe("Relevant excerpt from the source"),
22
+ // Patent-specific fields
23
+ patent_number: z.string().optional().describe("Patent number (e.g., US11123456B2)"),
24
+ assignee: z.string().optional().describe("Patent assignee/owner"),
25
+ filing_date: z.string().optional().describe("Patent filing date"),
26
+ priority_date: z.string().optional().describe("Patent priority date"),
27
+ claims_count: z.number().optional().describe("Number of claims"),
28
+ });
29
+ // ============================================================================
30
+ // Plan Tool Schemas
31
+ // ============================================================================
32
+ /**
33
+ * Input for sequential_research_plan tool
34
+ */
35
+ export const PlanInputSchema = z.object({
36
+ topic: z.string().min(1).describe("The research topic or question to investigate"),
37
+ depth: z.enum(["shallow", "standard", "deep"]).default("standard").describe("Research depth: shallow (3-5 queries), standard (5-10 queries), deep (10-20 queries)"),
38
+ focus_areas: z.array(z.string()).optional().describe("Specific aspects to focus on (e.g., ['technical details', 'market analysis'])"),
39
+ constraints: z.array(z.string()).optional().describe("Research constraints or exclusions (e.g., ['no paywalled sources', 'english only'])"),
40
+ output_format: z.enum(["markdown", "json", "structured"]).default("markdown").describe("Desired format for the final compiled output"),
41
+ });
42
+ /**
43
+ * A single research query with extraction goals
44
+ */
45
+ export const ResearchQuerySchema = z.object({
46
+ query_id: z.string().describe("Unique identifier for this query (e.g., q1, q2)"),
47
+ query_text: z.string().describe("The actual search query or question"),
48
+ query_type: z.enum([
49
+ // General query types
50
+ "definition", // What is X?
51
+ "comparison", // How does X compare to Y?
52
+ "enumeration", // List all X that...
53
+ "procedure", // How to do X?
54
+ "causation", // Why does X happen?
55
+ "evidence", // What evidence supports X?
56
+ "current_state", // What is the current state of X?
57
+ "historical", // History of X
58
+ "prediction", // Future of X
59
+ "opinion", // Expert opinions on X
60
+ // Patent-grade query types
61
+ "patent_broad", // Broad concept patent search
62
+ "patent_synonyms", // Alternative terminology/synonyms
63
+ "patent_problem_benefit", // Problem-solution framing
64
+ "patent_competitor", // Competitor/assignee search
65
+ "patent_limitation", // Component-level limitations (narrow novelty)
66
+ // Web query types for prior art
67
+ "web_academic", // Academic sources (.edu, .pdf)
68
+ "web_vendor", // Vendor documentation
69
+ "web_opensource", // OSS repositories (GitHub, GitLab)
70
+ "web_conference", // Conference papers (IEEE, ACM, arXiv)
71
+ ]).describe("Type of query for extraction strategy"),
72
+ query_family: z.enum(["general", "patent", "web"]).default("general").describe("Query family for source targeting"),
73
+ extraction_goals: z.array(z.string()).describe("Specific pieces of information to extract from results"),
74
+ priority: z.enum(["critical", "high", "medium", "low"]).default("medium").describe("Priority level for this query"),
75
+ depends_on: z.array(z.string()).optional().describe("Query IDs that must complete before this one"),
76
+ search_modifiers: z.array(z.string()).optional().describe("Search modifiers (e.g., 'site:.edu', 'filetype:pdf', 'assignee:Google')"),
77
+ });
78
+ /**
79
+ * Schema definition for expected raw results
80
+ */
81
+ export const RawResultSchemaDefinition = z.object({
82
+ query_id: z.string().describe("The query this schema applies to"),
83
+ required_fields: z.array(z.object({
84
+ field_name: z.string(),
85
+ field_type: z.enum(["string", "number", "boolean", "array", "object"]),
86
+ description: z.string(),
87
+ required: z.boolean().default(true),
88
+ })).describe("Required fields in the raw result"),
89
+ example: z.record(z.unknown()).optional().describe("Example of expected result structure"),
90
+ });
91
+ /**
92
+ * Output from sequential_research_plan tool
93
+ */
94
+ export const PlanOutputSchema = z.object({
95
+ plan_id: z.string().describe("Unique identifier for this research plan"),
96
+ topic: z.string().describe("Original research topic"),
97
+ created_at: z.string().describe("ISO timestamp when plan was created"),
98
+ summary: z.string().describe("Brief summary of the research plan"),
99
+ queries: z.array(ResearchQuerySchema).describe("Ordered list of research queries"),
100
+ result_schemas: z.array(RawResultSchemaDefinition).describe("Expected schema for each query's raw results"),
101
+ execution_order: z.array(z.array(z.string())).describe("Grouped query IDs - each group can run in parallel, groups run sequentially"),
102
+ estimated_sources: z.number().describe("Estimated number of sources to consult"),
103
+ metadata: z.object({
104
+ depth: z.string(),
105
+ focus_areas: z.array(z.string()),
106
+ constraints: z.array(z.string()),
107
+ output_format: z.string(),
108
+ }).describe("Original input parameters preserved for compilation"),
109
+ });
110
+ // ============================================================================
111
+ // Compile Tool Schemas
112
+ // ============================================================================
113
+ /**
114
+ * Raw result from executing a single query
115
+ */
116
+ export const RawResultSchema = z.object({
117
+ query_id: z.string().describe("Query ID this result corresponds to"),
118
+ success: z.boolean().describe("Whether the query execution succeeded"),
119
+ data: z.record(z.unknown()).optional().describe("Extracted data matching the result schema"),
120
+ sources: z.array(CitationSchema).optional().describe("Sources consulted for this query"),
121
+ error: z.string().optional().describe("Error message if success is false"),
122
+ execution_notes: z.string().optional().describe("Notes about the execution"),
123
+ });
124
+ /**
125
+ * Input for sequential_research_compile tool
126
+ */
127
+ export const CompileInputSchema = z.object({
128
+ plan: PlanOutputSchema.describe("The research plan to compile results for"),
129
+ raw_results: z.array(RawResultSchema).describe("Raw results from executing the plan queries"),
130
+ include_sources: z.boolean().default(true).describe("Include sources section in output"),
131
+ include_methodology: z.boolean().default(false).describe("Include methodology section"),
132
+ citation_style: z.enum(["inline", "footnote", "endnote"]).default("inline").describe("How to format citations in the output"),
133
+ });
134
+ /**
135
+ * A section in the compiled report
136
+ */
137
+ export const ReportSectionSchema = z.object({
138
+ heading: z.string().describe("Section heading"),
139
+ level: z.number().min(1).max(4).describe("Heading level (1-4)"),
140
+ content: z.string().describe("Section content in markdown"),
141
+ citations_used: z.array(z.string()).describe("Citation IDs used in this section"),
142
+ });
143
+ /**
144
+ * Prior art cluster for grouping related sources
145
+ */
146
+ export const PriorArtClusterSchema = z.object({
147
+ cluster_id: z.string().describe("Unique cluster identifier"),
148
+ theme: z.string().describe("Thematic description of the cluster"),
149
+ source_ids: z.array(z.string()).describe("Citation IDs in this cluster"),
150
+ relevance: z.enum(["high", "medium", "low"]).describe("Relevance to the research topic"),
151
+ overlap_notes: z.string().optional().describe("Notes on overlap with target claims"),
152
+ });
153
+ /**
154
+ * Claim risk flag for potential novelty issues
155
+ */
156
+ export const ClaimRiskFlagSchema = z.object({
157
+ risk_id: z.string().describe("Unique risk identifier"),
158
+ severity: z.enum(["critical", "high", "medium", "low"]).describe("Risk severity"),
159
+ category: z.enum([
160
+ "anticipation", // Prior art fully discloses the claim
161
+ "obviousness", // Combination of references makes claim obvious
162
+ "enablement", // Specification may not enable full scope
163
+ "written_description", // Claim may lack written description support
164
+ "indefiniteness", // Claim terms may be unclear
165
+ ]).describe("Type of claim risk"),
166
+ description: z.string().describe("Description of the risk"),
167
+ affected_elements: z.array(z.string()).optional().describe("Claim elements affected"),
168
+ blocking_sources: z.array(z.string()).optional().describe("Citation IDs that create this risk"),
169
+ mitigation: z.string().optional().describe("Suggested mitigation strategy"),
170
+ });
171
+ /**
172
+ * Novelty gap suggestion for differentiation
173
+ */
174
+ export const NoveltyGapSchema = z.object({
175
+ gap_id: z.string().describe("Unique gap identifier"),
176
+ limitation_type: z.enum([
177
+ "structural", // Physical/structural difference
178
+ "functional", // Functional difference
179
+ "material", // Material composition difference
180
+ "process", // Method step difference
181
+ "parameter", // Numerical parameter difference
182
+ "combination", // Novel combination of known elements
183
+ ]).describe("Type of limitation"),
184
+ description: z.string().describe("Description of the potential differentiation"),
185
+ confidence: z.enum(["high", "medium", "low"]).describe("Confidence in novelty"),
186
+ supporting_evidence: z.array(z.string()).optional().describe("Citation IDs supporting this gap"),
187
+ claim_language_suggestion: z.string().optional().describe("Suggested claim language"),
188
+ });
189
+ /**
190
+ * Output from sequential_research_compile tool
191
+ */
192
+ export const CompileOutputSchema = z.object({
193
+ report_id: z.string().describe("Unique identifier for this report"),
194
+ plan_id: z.string().describe("ID of the plan this report was compiled from"),
195
+ title: z.string().describe("Report title"),
196
+ compiled_at: z.string().describe("ISO timestamp when report was compiled"),
197
+ executive_summary: z.string().describe("Brief executive summary"),
198
+ sections: z.array(ReportSectionSchema).describe("Report sections"),
199
+ markdown_report: z.string().describe("Complete markdown-formatted report"),
200
+ sources: z.array(CitationSchema).describe("Consolidated list of all sources"),
201
+ statistics: z.object({
202
+ queries_executed: z.number(),
203
+ queries_succeeded: z.number(),
204
+ queries_failed: z.number(),
205
+ total_sources: z.number(),
206
+ word_count: z.number(),
207
+ patent_sources: z.number().optional(),
208
+ web_sources: z.number().optional(),
209
+ }).describe("Report statistics"),
210
+ // Patent-grade analysis outputs
211
+ prior_art_clusters: z.array(PriorArtClusterSchema).optional().describe("Grouped prior art by theme/relevance"),
212
+ claim_risk_flags: z.array(ClaimRiskFlagSchema).optional().describe("Identified risks to patentability"),
213
+ novelty_gaps: z.array(NoveltyGapSchema).optional().describe("Suggested limitations for differentiation"),
214
+ warnings: z.array(z.string()).optional().describe("Any warnings generated during compilation"),
215
+ });
216
+ // ============================================================================
217
+ // Tool Definitions for MCP
218
+ // ============================================================================
219
+ /**
220
+ * JSON Schema representations for MCP tool definitions
221
+ */
222
+ export const toolSchemas = {
223
+ sequential_research_plan: {
224
+ input: PlanInputSchema,
225
+ output: PlanOutputSchema,
226
+ },
227
+ sequential_research_compile: {
228
+ input: CompileInputSchema,
229
+ output: CompileOutputSchema,
230
+ },
231
+ };
232
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mDAAmD,CAAC;IAC5E,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAC1G,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACzD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IACxD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAClF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAC3E,yBAAyB;IACzB,aAAa,EAAE,CAAC,CAAC,MAAM,E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AC,QAAQ,EAAE;QACrC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACnC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAChC,gCAAgC;IAChC,kBAAkB,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACpE,sCAAsC,CACvC;IACD,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAChE,mCAAmC,CACpC;IACD,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CACzD,2CAA2C,CAC5C;IACD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;CAC/F,CAAC,CAAC;AAIH,+EAA+E;AAC/E,2BAA2B;AAC3B,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,wBAAwB,EAAE;QACxB,KAAK,EAAE,eAAe;QACtB,MAAM,EAAE,gBAAgB;KACzB;IACD,2BAA2B,EAAE;QAC3B,KAAK,EAAE,kBAAkB;QACzB,MAAM,EAAE,mBAAmB;KAC5B;CACO,CAAC"}
@@ -0,0 +1,409 @@
1
+ # MCP Sequential Research Guidance
2
+
3
+ This document explains when to use each tool and how Claude Code should orchestrate the research workflow.
4
+
5
+ ## When to Use Which Tool
6
+
7
+ ### Use `sequential_research_plan` when:
8
+
9
+ - **Prompt has multiple concepts** — The research topic spans multiple domains or requires investigating several interrelated ideas (e.g., "Compare transformer architectures for patent classification with attention mechanisms")
10
+ - **You need a reproducible search strategy** — You want a documented, repeatable set of queries that can be audited or re-run later
11
+ - **You want query coverage and dedupe guidance** — The planner identifies overlapping queries and orders them to avoid redundant searches
12
+ - **You're starting a new research task** — Always begin with the plan tool to structure your investigation
13
+
14
+ ### Use `sequential_research_compile` when:
15
+
16
+ - **You already executed searches** — Via Google Patents MCP (`search_patents`), Google Search MCP (Google Custom Search), or other data sources
17
+ - **You want a report with citations + risk analysis** — The compiler generates structured markdown with machine-parseable citations
18
+ - **You need downstream processing** — The citation format (`[S#]`) is designed for claim-miner compatibility
19
+
20
+ ## How Claude Code Should Run the Workflow
21
+
22
+ This is the exact **operator loop** Claude Code follows for comprehensive research:
23
+
24
+ ### Complete Workflow Diagram
25
+
26
+ ```
27
+ ┌─────────────────────────────────────────────────────────────────────┐
28
+ │ SEQUENTIAL RESEARCH WORKFLOW │
29
+ ├─────────────────────────────────────────────────────────────────────┤
30
+ │ │
31
+ │ 1. PLAN │
32
+ │ └─→ sequential-research:sequential_research_plan(prompt, constraints) │
33
+ │ ↓ │
34
+ │ 2. WEB QUERIES (for each plan.queries where query_family == "web") │
35
+ │ └─→ google-search:search({query, num: 10}) │
36
+ │ Returns: {title, link, snippet}[] │
37
+ │ ↓ │
38
+ │ 3. SCRAPE WEB CONTENT │
39
+ │ ├─→ Collect top URLs (dedupe) │
40
+ │ ├─→ If multiple: firecrawl:firecrawl_batch_scrape({urls}) │
41
+ │ └─→ If single: firecrawl:firecrawl_scrape({url}) │
42
+ │ Returns: {markdown, metadata} │
43
+ │ ↓ │
44
+ │ 4. PATENT QUERIES (for each plan.queries where query_family == "patent") │
45
+ │ └─→ google-patents:search_patents({query, num_results}) │
46
+ │ Returns: {patent_number, title, abstract, claims}[] │
47
+ │ ↓ │
48
+ │ 5. NORMALIZE │
49
+ │ └─→ Transform all results → raw_results[] with S1..Sn IDs │
50
+ │ ↓ │
51
+ │ 6. COMPILE │
52
+ │ └─→ sequential-research:sequential_research_compile(plan, raw_results) │
53
+ │ ↓ │
54
+ │ 7. SAVE │
55
+ │ ├─→ research/<topic>/report.md │
56
+ │ ├─→ research/<topic>/sources.json │
57
+ │ ├─→ research/<topic>/plan.json │
58
+ │ └─→ research/<topic>/raw_results.json │
59
+ │ │
60
+ └─────────────────────────────────────────────────────────────────────┘
61
+ ```
62
+
63
+ ---
64
+
65
+ ### Step 1: Generate Research Plan
66
+
67
+ ```json
68
+ {
69
+ "tool": "sequential-research:sequential_research_plan",
70
+ "arguments": {
71
+ "topic": "photonic computing for AI inference acceleration",
72
+ "depth": "standard",
73
+ "focus_areas": ["silicon photonics", "energy efficiency", "latency"],
74
+ "constraints": ["patent-focused", "english only"]
75
+ }
76
+ }
77
+ ```
78
+
79
+ This returns:
80
+ - Ordered queries with priorities and query families (`general`, `patent`, `web`)
81
+ - Extraction goals per query
82
+ - Expected result schemas
83
+ - Execution order (parallel groups)
84
+ - Search modifiers for each query type
85
+
86
+ ### Step 2: Execute Web Queries via Google Search MCP
87
+
88
+ For each query where `query_family == "web"`:
89
+
90
+ ```json
91
+ {
92
+ "tool": "google-search:search",
93
+ "arguments": {
94
+ "query": "photonic computing silicon photonics site:.edu OR filetype:pdf",
95
+ "num": 10
96
+ }
97
+ }
98
+ ```
99
+
100
+ **Response format:**
101
+ ```json
102
+ {
103
+ "results": [
104
+ {
105
+ "title": "Silicon Photonics for AI - MIT",
106
+ "link": "https://example.mit.edu/photonics.pdf",
107
+ "snippet": "Recent advances in silicon photonics..."
108
+ }
109
+ ]
110
+ }
111
+ ```
112
+
113
+ ### Step 3: Scrape Web Content via Firecrawl MCP
114
+
115
+ After collecting search results, extract full content using Firecrawl.
116
+
117
+ **For multiple URLs (recommended for efficiency):**
118
+ ```json
119
+ {
120
+ "tool": "firecrawl:firecrawl_batch_scrape",
121
+ "arguments": {
122
+ "urls": [
123
+ "https://example.mit.edu/photonics.pdf",
124
+ "https://lightmatter.co/technology",
125
+ "https://ieee.org/article/photonic-computing"
126
+ ],
127
+ "options": {
128
+ "formats": ["markdown"],
129
+ "onlyMainContent": true
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
135
+ **For a single URL:**
136
+ ```json
137
+ {
138
+ "tool": "firecrawl:firecrawl_scrape",
139
+ "arguments": {
140
+ "url": "https://example.mit.edu/photonics.pdf",
141
+ "formats": ["markdown"],
142
+ "onlyMainContent": true
143
+ }
144
+ }
145
+ ```
146
+
147
+ **Response format:**
148
+ ```json
149
+ {
150
+ "success": true,
151
+ "data": {
152
+ "markdown": "# Silicon Photonics for AI\n\nRecent advances...",
153
+ "metadata": {
154
+ "title": "Silicon Photonics for AI",
155
+ "sourceURL": "https://example.mit.edu/photonics.pdf"
156
+ }
157
+ }
158
+ }
159
+ ```
160
+
161
+ ### Step 4: Execute Patent Queries via Google Patents MCP
162
+
163
+ For each query where `query_family == "patent"`:
164
+
165
+ ```json
166
+ {
167
+ "tool": "google-patents:search_patents",
168
+ "arguments": {
169
+ "query": "photonic neural network accelerator",
170
+ "num_results": 10,
171
+ "country": "US",
172
+ "after": "2020-01-01"
173
+ }
174
+ }
175
+ ```
176
+
177
+ **Response format:**
178
+ ```json
179
+ {
180
+ "patents": [
181
+ {
182
+ "patent_number": "US11123456B2",
183
+ "title": "Photonic Neural Network System",
184
+ "abstract": "A system for neural network inference...",
185
+ "assignee": "Intel Corporation",
186
+ "filing_date": "2021-03-15",
187
+ "claims": ["1. A photonic computing system comprising..."]
188
+ }
189
+ ]
190
+ }
191
+ ```
192
+
193
+ ### Step 5: Normalize Results into `raw_results[]`
194
+
195
+ Transform all responses into the standard schema with sequential source IDs:
196
+
197
+ ```json
198
+ [
199
+ {
200
+ "query_id": "q1",
201
+ "success": true,
202
+ "data": {
203
+ "definition": "Photonic computing uses light instead of electrons...",
204
+ "characteristics": ["Low latency", "High bandwidth", "Energy efficient"],
205
+ "examples": ["Intel Silicon Photonics", "Lightmatter Envise"]
206
+ },
207
+ "sources": [
208
+ {
209
+ "id": "S1",
210
+ "source_type": "patent",
211
+ "title": "US11123456B2 - Photonic Neural Network System",
212
+ "url": "https://patents.google.com/patent/US11123456B2",
213
+ "patent_number": "US11123456B2",
214
+ "assignee": "Intel Corporation",
215
+ "filing_date": "2021-03-15",
216
+ "accessed_date": "2025-01-13",
217
+ "excerpt": "A photonic computing system comprising an array of Mach-Zehnder interferometers..."
218
+ },
219
+ {
220
+ "id": "S2",
221
+ "source_type": "web",
222
+ "title": "Silicon Photonics for AI - MIT",
223
+ "url": "https://example.mit.edu/photonics.pdf",
224
+ "accessed_date": "2025-01-13",
225
+ "excerpt": "Recent advances in silicon photonics have enabled..."
226
+ }
227
+ ]
228
+ }
229
+ ]
230
+ ```
231
+
232
+ **Source ID assignment rules:**
233
+ 1. Assign `S1`, `S2`, etc. sequentially across all results
234
+ 2. Deduplicate URLs before assigning IDs
235
+ 3. Patents get `source_type: "patent"` with extra fields
236
+ 4. Web content gets `source_type: "web"`
237
+ 5. Firecrawl markdown content goes in `excerpt` (truncated if needed)
238
+
239
+ ### Step 6: Call `sequential_research_compile`
240
+
241
+ ```json
242
+ {
243
+ "tool": "sequential-research:sequential_research_compile",
244
+ "arguments": {
245
+ "plan": { /* full plan object from step 1 */ },
246
+ "raw_results": [ /* array from step 5 */ ],
247
+ "include_sources": true,
248
+ "include_methodology": true,
249
+ "citation_style": "inline"
250
+ }
251
+ }
252
+ ```
253
+
254
+ ### Step 7: Save Outputs
255
+
256
+ Create the research output directory and save files:
257
+
258
+ ```
259
+ research/<topic-slug>/
260
+ ├── report.md # The compiled markdown report
261
+ ├── sources.json # Structured sources list
262
+ ├── plan.json # Original plan for reproducibility
263
+ └── raw_results.json # Raw data for re-processing
264
+ ```
265
+
266
+ Example file operations:
267
+ ```javascript
268
+ // Save all outputs
269
+ await fs.mkdir(`research/${slugify(topic)}`, { recursive: true });
270
+ await fs.writeFile(`research/${slug}/report.md`, output.markdown_report);
271
+ await fs.writeFile(`research/${slug}/sources.json`, JSON.stringify(output.sources, null, 2));
272
+ await fs.writeFile(`research/${slug}/plan.json`, JSON.stringify(plan, null, 2));
273
+ await fs.writeFile(`research/${slug}/raw_results.json`, JSON.stringify(rawResults, null, 2));
274
+ ```
275
+
276
+ ---
277
+
278
+ ## MCP Server Integration Reference
279
+
280
+ | Step | MCP Server | Tool | Purpose |
281
+ |------|-----------|------|---------|
282
+ | 1 | sequential-research | `sequential_research_plan` | Generate structured query plan |
283
+ | 2 | google-search | `search` | Get web search results |
284
+ | 3 | firecrawl | `firecrawl_scrape` / `firecrawl_batch_scrape` | Extract full page content |
285
+ | 4 | google-patents | `search_patents` | Search patent database |
286
+ | 5 | — | — | Normalize to raw_results[] |
287
+ | 6 | sequential-research | `sequential_research_compile` | Generate report with citations |
288
+ | 7 | — | — | Save to filesystem |
289
+
290
+ ---
291
+
292
+ ## Firecrawl Integration Details
293
+
294
+ ### When to Use Batch vs Single Scrape
295
+
296
+ | Scenario | Tool | Reason |
297
+ |----------|------|--------|
298
+ | 5+ URLs from same query | `firecrawl_batch_scrape` | Efficiency, rate limiting |
299
+ | 1-4 URLs | `firecrawl_scrape` (multiple calls) | Lower overhead |
300
+ | PDF documents | `firecrawl_scrape` | Better PDF handling |
301
+ | Real-time updates needed | `firecrawl_scrape` | Immediate results |
302
+
303
+ ### Firecrawl Options
304
+
305
+ ```json
306
+ {
307
+ "formats": ["markdown"], // Output format
308
+ "onlyMainContent": true, // Skip headers/footers
309
+ "includeTags": ["article", "main", "section"], // Focus on content
310
+ "excludeTags": ["nav", "footer", "aside"], // Skip navigation
311
+ "waitFor": 2000, // Wait for JS rendering (ms)
312
+ "timeout": 30000 // Request timeout (ms)
313
+ }
314
+ ```
315
+
316
+ ### Handling Firecrawl Errors
317
+
318
+ ```json
319
+ {
320
+ "query_id": "q3",
321
+ "success": true,
322
+ "data": { /* partial data from other sources */ },
323
+ "sources": [
324
+ {
325
+ "id": "S5",
326
+ "source_type": "web",
327
+ "title": "Page Title (scrape failed)",
328
+ "url": "https://example.com/blocked",
329
+ "excerpt": "[Content unavailable - scrape blocked by robots.txt]"
330
+ }
331
+ ],
332
+ "execution_notes": "1 of 5 URLs failed to scrape"
333
+ }
334
+ ```
335
+
336
+ ## Citation Format Requirement
337
+
338
+ Citations must be **stable** and **machine-parseable** for downstream claim-mining.
339
+
340
+ ### Inline Format
341
+
342
+ In the body of the report:
343
+ ```markdown
344
+ Photonic computing achieves 10x lower latency compared to electronic alternatives [S3].
345
+ The Mach-Zehnder modulator design enables this performance [S3, S7].
346
+ ```
347
+
348
+ ### Sources Table Format
349
+
350
+ At the end of the report:
351
+ ```markdown
352
+ ## Sources
353
+
354
+ | ID | Title | URL |
355
+ |----|-------|-----|
356
+ | [S1] | US Patent 11,123,456 - Photonic Neural Processor | https://patents.google.com/patent/US11123456 |
357
+ | [S2] | Lightmatter Technical Brief | https://lightmatter.co/tech |
358
+ | [S3] | Silicon Photonics Benchmarks 2024 | https://example.com/benchmarks |
359
+ ```
360
+
361
+ ### Why This Matters
362
+
363
+ The claim-miner can:
364
+ 1. Parse `[S#]` references deterministically
365
+ 2. Link claims to specific sources
366
+ 3. Generate evidence chains for patent applications
367
+ 4. Audit source coverage per claim
368
+
369
+ ## Error Handling
370
+
371
+ ### Failed Queries
372
+
373
+ If a query fails, include it in `raw_results` with:
374
+ ```json
375
+ {
376
+ "query_id": "q3",
377
+ "success": false,
378
+ "error": "Rate limit exceeded on Google Patents API"
379
+ }
380
+ ```
381
+
382
+ The compiler will:
383
+ - Skip failed queries in the report
384
+ - Add warnings to the output
385
+ - Report statistics on query success rate
386
+
387
+ ### Partial Results
388
+
389
+ If a query partially succeeds, include available data:
390
+ ```json
391
+ {
392
+ "query_id": "q2",
393
+ "success": true,
394
+ "data": {
395
+ "definition": "Found",
396
+ "characteristics": [] // Empty if not found
397
+ },
398
+ "execution_notes": "Only 2 of 5 expected fields populated"
399
+ }
400
+ ```
401
+
402
+ ## Best Practices
403
+
404
+ 1. **Always start with a plan** — Even for simple topics, the plan provides structure
405
+ 2. **Use parallel execution** — Queries in the same execution group can run concurrently
406
+ 3. **Normalize sources immediately** — Convert to standard schema before compile
407
+ 4. **Preserve raw data** — Save `raw_results.json` for debugging and re-processing
408
+ 5. **Check citation coverage** — Every significant claim should have a `[S#]` reference
409
+ 6. **Use stable IDs** — `S1`, `S2`, etc. are more stable than URL-based refs