@yeyuan98/opencode-bioresearcher-plugin 1.5.0 → 1.5.2-alpha.2

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.
Files changed (173) hide show
  1. package/README.md +50 -50
  2. package/dist/agents/bioresearcher/prompt.d.ts +1 -1
  3. package/dist/agents/bioresearcher/prompt.js +235 -27
  4. package/dist/agents/bioresearcherDR/prompt.d.ts +1 -1
  5. package/dist/agents/bioresearcherDR/prompt.js +8 -8
  6. package/dist/agents/bioresearcherDR_worker/prompt.d.ts +3 -2
  7. package/dist/agents/bioresearcherDR_worker/prompt.js +37 -12
  8. package/dist/index.js +6 -6
  9. package/dist/shared/tool-restrictions.d.ts +2 -2
  10. package/dist/shared/tool-restrictions.js +4 -3
  11. package/dist/skills/bioresearcher-core/SKILL.md +58 -1
  12. package/dist/skills/bioresearcher-core/patterns/bioresearcher/analysis-methods.md +551 -0
  13. package/dist/skills/bioresearcher-core/patterns/bioresearcher/best-practices.md +647 -0
  14. package/dist/skills/bioresearcher-core/patterns/bioresearcher/python-standards.md +944 -0
  15. package/dist/skills/bioresearcher-core/patterns/bioresearcher/report-template.md +613 -0
  16. package/dist/skills/bioresearcher-core/patterns/bioresearcher/tool-selection.md +481 -0
  17. package/dist/skills/bioresearcher-core/patterns/citations.md +234 -0
  18. package/dist/skills/bioresearcher-core/patterns/rate-limiting.md +167 -0
  19. package/dist/skills/bioresearcher-tests/README.md +90 -0
  20. package/dist/skills/bioresearcher-tests/SKILL.md +255 -0
  21. package/dist/skills/bioresearcher-tests/pyproject.toml +6 -0
  22. package/dist/skills/bioresearcher-tests/resources/json_samples/in_markdown.md.gz +0 -0
  23. package/dist/skills/bioresearcher-tests/resources/json_samples/nested_object.json.gz +0 -0
  24. package/dist/skills/bioresearcher-tests/resources/json_samples/schema_draft7.json.gz +0 -0
  25. package/dist/skills/bioresearcher-tests/resources/json_samples/simple_array.json.gz +0 -0
  26. package/dist/skills/bioresearcher-tests/resources/json_samples/simple_object.json.gz +0 -0
  27. package/dist/skills/bioresearcher-tests/resources/obo_sample.obo.gz +0 -0
  28. package/dist/skills/bioresearcher-tests/resources/pubmed_sample.xml.gz +0 -0
  29. package/dist/skills/bioresearcher-tests/resources/table_sample.xlsx.gz +0 -0
  30. package/dist/skills/bioresearcher-tests/test_cases/json_tests.md +137 -0
  31. package/dist/skills/bioresearcher-tests/test_cases/misc_tests.md +141 -0
  32. package/dist/skills/bioresearcher-tests/test_cases/parser_tests.md +80 -0
  33. package/dist/skills/bioresearcher-tests/test_cases/skill_tests.md +59 -0
  34. package/dist/skills/bioresearcher-tests/test_cases/table_tests.md +194 -0
  35. package/dist/skills/bioresearcher-tests/test_runner.py +607 -0
  36. package/dist/skills/env-jsonc-setup/SKILL.md +206 -206
  37. package/dist/skills/long-table-summary/SKILL.md +117 -46
  38. package/dist/skills/long-table-summary/combine_outputs.py +55 -9
  39. package/dist/skills/long-table-summary/generate_prompts.py +9 -0
  40. package/dist/skills/pubmed-weekly/pubmed_weekly.py +130 -29
  41. package/dist/{db-tools → tools/db}/backends/mysql/translator.js +23 -23
  42. package/dist/{db-tools → tools/db}/tools.js +34 -34
  43. package/dist/{misc-tools → tools/misc}/json-validate.js +4 -5
  44. package/dist/tools/sandbox/bash-parser.d.ts +17 -0
  45. package/dist/tools/sandbox/bash-parser.js +166 -0
  46. package/dist/tools/sandbox/escape-scenarios.test.d.ts +7 -0
  47. package/dist/tools/sandbox/escape-scenarios.test.js +182 -0
  48. package/dist/tools/sandbox/expander.d.ts +30 -0
  49. package/dist/tools/sandbox/expander.js +57 -0
  50. package/dist/tools/sandbox/final-verification.test.d.ts +6 -0
  51. package/dist/tools/sandbox/final-verification.test.js +70 -0
  52. package/dist/tools/sandbox/hooks.d.ts +25 -0
  53. package/dist/tools/sandbox/hooks.js +217 -0
  54. package/dist/tools/sandbox/index.d.ts +19 -0
  55. package/dist/tools/sandbox/index.js +24 -0
  56. package/dist/tools/sandbox/manager.d.ts +60 -0
  57. package/dist/tools/sandbox/manager.js +113 -0
  58. package/dist/tools/sandbox/sandbox.integration.test.d.ts +7 -0
  59. package/dist/tools/sandbox/sandbox.integration.test.js +106 -0
  60. package/dist/tools/sandbox/sandbox.test.d.ts +6 -0
  61. package/dist/tools/sandbox/sandbox.test.js +160 -0
  62. package/dist/tools/sandbox/tool.d.ts +66 -0
  63. package/dist/tools/sandbox/tool.js +163 -0
  64. package/dist/tools/sandbox/types.d.ts +38 -0
  65. package/dist/tools/sandbox/types.js +6 -0
  66. package/dist/tools/sandbox/validator.d.ts +33 -0
  67. package/dist/tools/sandbox/validator.js +150 -0
  68. package/dist/{skill-tools → tools/skill}/registry.js +1 -2
  69. package/dist/{table-tools → tools/table}/utils.js +4 -4
  70. package/package.json +1 -1
  71. package/dist/db-tools/executor.d.ts +0 -13
  72. package/dist/db-tools/executor.js +0 -54
  73. package/dist/db-tools/pool.d.ts +0 -8
  74. package/dist/db-tools/pool.js +0 -49
  75. package/dist/db-tools/tools/index.d.ts +0 -27
  76. package/dist/db-tools/tools/index.js +0 -191
  77. package/dist/db-tools/types.d.ts +0 -94
  78. package/dist/db-tools/types.js +0 -40
  79. package/dist/misc-tools/json-tools.d.ts +0 -33
  80. package/dist/misc-tools/json-tools.js +0 -187
  81. package/dist/skill/frontmatter.d.ts +0 -2
  82. package/dist/skill/frontmatter.js +0 -65
  83. package/dist/skill/index.d.ts +0 -3
  84. package/dist/skill/index.js +0 -2
  85. package/dist/skill/registry.d.ts +0 -11
  86. package/dist/skill/registry.js +0 -64
  87. package/dist/skill/tool.d.ts +0 -9
  88. package/dist/skill/tool.js +0 -115
  89. package/dist/skill/types.d.ts +0 -22
  90. package/dist/skill/types.js +0 -7
  91. /package/dist/{db-tools → tools/db}/backends/index.d.ts +0 -0
  92. /package/dist/{db-tools → tools/db}/backends/index.js +0 -0
  93. /package/dist/{db-tools → tools/db}/backends/mongodb/backend.d.ts +0 -0
  94. /package/dist/{db-tools → tools/db}/backends/mongodb/backend.js +0 -0
  95. /package/dist/{db-tools → tools/db}/backends/mongodb/connection.d.ts +0 -0
  96. /package/dist/{db-tools → tools/db}/backends/mongodb/connection.js +0 -0
  97. /package/dist/{db-tools → tools/db}/backends/mongodb/index.d.ts +0 -0
  98. /package/dist/{db-tools → tools/db}/backends/mongodb/index.js +0 -0
  99. /package/dist/{db-tools → tools/db}/backends/mongodb/translator.d.ts +0 -0
  100. /package/dist/{db-tools → tools/db}/backends/mongodb/translator.js +0 -0
  101. /package/dist/{db-tools → tools/db}/backends/mysql/backend.d.ts +0 -0
  102. /package/dist/{db-tools → tools/db}/backends/mysql/backend.js +0 -0
  103. /package/dist/{db-tools → tools/db}/backends/mysql/connection.d.ts +0 -0
  104. /package/dist/{db-tools → tools/db}/backends/mysql/connection.js +0 -0
  105. /package/dist/{db-tools → tools/db}/backends/mysql/index.d.ts +0 -0
  106. /package/dist/{db-tools → tools/db}/backends/mysql/index.js +0 -0
  107. /package/dist/{db-tools → tools/db}/backends/mysql/translator.d.ts +0 -0
  108. /package/dist/{db-tools → tools/db}/core/base.d.ts +0 -0
  109. /package/dist/{db-tools → tools/db}/core/base.js +0 -0
  110. /package/dist/{db-tools → tools/db}/core/config-loader.d.ts +0 -0
  111. /package/dist/{db-tools → tools/db}/core/config-loader.js +0 -0
  112. /package/dist/{db-tools → tools/db}/core/index.d.ts +0 -0
  113. /package/dist/{db-tools → tools/db}/core/index.js +0 -0
  114. /package/dist/{db-tools → tools/db}/core/jsonc-parser.d.ts +0 -0
  115. /package/dist/{db-tools → tools/db}/core/jsonc-parser.js +0 -0
  116. /package/dist/{db-tools → tools/db}/core/validator.d.ts +0 -0
  117. /package/dist/{db-tools → tools/db}/core/validator.js +0 -0
  118. /package/dist/{db-tools → tools/db}/index.d.ts +0 -0
  119. /package/dist/{db-tools → tools/db}/index.js +0 -0
  120. /package/dist/{db-tools → tools/db}/interface/backend.d.ts +0 -0
  121. /package/dist/{db-tools → tools/db}/interface/backend.js +0 -0
  122. /package/dist/{db-tools → tools/db}/interface/connection.d.ts +0 -0
  123. /package/dist/{db-tools → tools/db}/interface/connection.js +0 -0
  124. /package/dist/{db-tools → tools/db}/interface/index.d.ts +0 -0
  125. /package/dist/{db-tools → tools/db}/interface/index.js +0 -0
  126. /package/dist/{db-tools → tools/db}/interface/query.d.ts +0 -0
  127. /package/dist/{db-tools → tools/db}/interface/query.js +0 -0
  128. /package/dist/{db-tools → tools/db}/interface/schema.d.ts +0 -0
  129. /package/dist/{db-tools → tools/db}/interface/schema.js +0 -0
  130. /package/dist/{db-tools → tools/db}/tools.d.ts +0 -0
  131. /package/dist/{db-tools → tools/db}/utils.d.ts +0 -0
  132. /package/dist/{db-tools → tools/db}/utils.js +0 -0
  133. /package/dist/{misc-tools → tools/misc}/calculator.d.ts +0 -0
  134. /package/dist/{misc-tools → tools/misc}/calculator.js +0 -0
  135. /package/dist/{misc-tools → tools/misc}/index.d.ts +0 -0
  136. /package/dist/{misc-tools → tools/misc}/index.js +0 -0
  137. /package/dist/{misc-tools → tools/misc}/json-extract.d.ts +0 -0
  138. /package/dist/{misc-tools → tools/misc}/json-extract.js +0 -0
  139. /package/dist/{misc-tools → tools/misc}/json-infer.d.ts +0 -0
  140. /package/dist/{misc-tools → tools/misc}/json-infer.js +0 -0
  141. /package/dist/{misc-tools → tools/misc}/json-validate.d.ts +0 -0
  142. /package/dist/{misc-tools → tools/misc}/timer.d.ts +0 -0
  143. /package/dist/{misc-tools → tools/misc}/timer.js +0 -0
  144. /package/dist/{parser-tools → tools/parser}/obo/index.d.ts +0 -0
  145. /package/dist/{parser-tools → tools/parser}/obo/index.js +0 -0
  146. /package/dist/{parser-tools → tools/parser}/obo/obo.d.ts +0 -0
  147. /package/dist/{parser-tools → tools/parser}/obo/obo.js +0 -0
  148. /package/dist/{parser-tools → tools/parser}/obo/types.d.ts +0 -0
  149. /package/dist/{parser-tools → tools/parser}/obo/types.js +0 -0
  150. /package/dist/{parser-tools → tools/parser}/obo/utils.d.ts +0 -0
  151. /package/dist/{parser-tools → tools/parser}/obo/utils.js +0 -0
  152. /package/dist/{parser-tools → tools/parser}/pubmed/index.d.ts +0 -0
  153. /package/dist/{parser-tools → tools/parser}/pubmed/index.js +0 -0
  154. /package/dist/{parser-tools → tools/parser}/pubmed/pubmed.d.ts +0 -0
  155. /package/dist/{parser-tools → tools/parser}/pubmed/pubmed.js +0 -0
  156. /package/dist/{parser-tools → tools/parser}/pubmed/types.d.ts +0 -0
  157. /package/dist/{parser-tools → tools/parser}/pubmed/types.js +0 -0
  158. /package/dist/{parser-tools → tools/parser}/pubmed/utils.d.ts +0 -0
  159. /package/dist/{parser-tools → tools/parser}/pubmed/utils.js +0 -0
  160. /package/dist/{skill-tools → tools/skill}/frontmatter.d.ts +0 -0
  161. /package/dist/{skill-tools → tools/skill}/frontmatter.js +0 -0
  162. /package/dist/{skill-tools → tools/skill}/index.d.ts +0 -0
  163. /package/dist/{skill-tools → tools/skill}/index.js +0 -0
  164. /package/dist/{skill-tools → tools/skill}/registry.d.ts +0 -0
  165. /package/dist/{skill-tools → tools/skill}/tool.d.ts +0 -0
  166. /package/dist/{skill-tools → tools/skill}/tool.js +0 -0
  167. /package/dist/{skill-tools → tools/skill}/types.d.ts +0 -0
  168. /package/dist/{skill-tools → tools/skill}/types.js +0 -0
  169. /package/dist/{table-tools → tools/table}/index.d.ts +0 -0
  170. /package/dist/{table-tools → tools/table}/index.js +0 -0
  171. /package/dist/{table-tools → tools/table}/tools.d.ts +0 -0
  172. /package/dist/{table-tools → tools/table}/tools.js +0 -0
  173. /package/dist/{table-tools → tools/table}/utils.d.ts +0 -0
@@ -0,0 +1,481 @@
1
+ # Tool Selection Decision Framework
2
+
3
+ Comprehensive decision trees for choosing the correct tool based on user intent and data source.
4
+
5
+ ## Overview
6
+
7
+ This pattern guides intelligent tool selection across 7 tool categories:
8
+ 1. Database Tools (db*)
9
+ 2. Table Tools (table*)
10
+ 3. Web Tools (web*)
11
+ 4. BioMCP Tools (biomcp*)
12
+ 5. Parser Tools (parse*)
13
+ 6. Miscellaneous Tools
14
+ 7. Core File Tools
15
+
16
+ ---
17
+
18
+ ## 1. Data Source Identification
19
+
20
+ ```
21
+ USER INTENT ANALYSIS:
22
+ ├─ "Query database" / "SQL" / "table in database"
23
+ │ → DATABASE TOOLS (db*)
24
+
25
+ ├─ "Excel file" / "CSV file" / "table file" / "xlsx" / "spreadsheet"
26
+ │ → TABLE TOOLS (table*)
27
+
28
+ ├─ "website" / "web page" / "URL" / "fetch from"
29
+ │ → WEB TOOLS (web*)
30
+
31
+ ├─ "PubMed" / "articles" / "literature" / "papers" / "publications"
32
+ │ → BIOMCP ARTICLE TOOLS
33
+
34
+ ├─ "clinical trial" / "NCT" / "trial data"
35
+ │ → BIOMCP TRIAL TOOLS
36
+
37
+ ├─ "gene" / "variant" / "mutation" / "genomic"
38
+ │ → BIOMCP GENE/VARIANT TOOLS
39
+
40
+ ├─ "drug" / "compound" / "FDA" / "medication"
41
+ │ → BIOMCP DRUG/FDA TOOLS
42
+
43
+ ├─ "parse" / "convert" / "XML" / "OBO" / "ontology"
44
+ │ → PARSER TOOLS (parse*)
45
+
46
+ └─ Unclear intent
47
+ → ASK user for clarification via question tool
48
+ ```
49
+
50
+ ---
51
+
52
+ ## 2. Database Tools Decision Tree
53
+
54
+ ### When to Use
55
+ - User mentions database, SQL, or structured query
56
+ - Need to query relational or document database
57
+ - Data exists in MySQL or MongoDB
58
+
59
+ ### Workflow
60
+
61
+ ```
62
+ IF user mentions database/SQL:
63
+
64
+ Step 1: Check Configuration
65
+ IF env.jsonc does NOT exist:
66
+ → Load skill 'env-jsonc-setup'
67
+ → Follow skill workflow to configure database
68
+
69
+ Step 2: Discover Available Data
70
+ dbListTables() → Show all tables to user
71
+ → Identify relevant tables
72
+
73
+ Step 3: Understand Schema
74
+ dbDescribeTable(table_name) → Get column structure
75
+ → Identify available fields, data types, keys
76
+
77
+ Step 4: Query with Filters (BEST PRACTICE)
78
+ ✅ DO: dbQuery(
79
+ "SELECT * FROM trials WHERE phase = :phase AND status = :status",
80
+ {phase: "Phase 3", status: "Recruiting"}
81
+ )
82
+
83
+ ❌ DON'T: dbQuery("SELECT * FROM trials")
84
+ → then filter in Python
85
+
86
+ Step 5: Use Named Parameters (SAFETY)
87
+ - NEVER concatenate SQL strings
88
+ - ALWAYS use :paramName syntax
89
+ - Pass parameters as second argument
90
+ ```
91
+
92
+ ### Example: Database Research Workflow
93
+
94
+ ```markdown
95
+ User: "Find all Phase 3 melanoma trials from the database"
96
+
97
+ Agent actions:
98
+ 1. dbListTables() → See available tables
99
+ 2. dbDescribeTable("clinical_trials") → Understand schema
100
+ 3. dbQuery(
101
+ "SELECT * FROM clinical_trials
102
+ WHERE phase = :phase
103
+ AND condition LIKE :condition
104
+ AND status = :status",
105
+ {
106
+ phase: "Phase 3",
107
+ condition: "%melanoma%",
108
+ status: "Recruiting"
109
+ }
110
+ )
111
+ 4. Return filtered results with proper citations
112
+ ```
113
+
114
+ ### Tool Reference
115
+
116
+ | Tool | Purpose | When to Use |
117
+ |------|---------|-------------|
118
+ | `dbListTables` | List all tables/collections | Initial discovery |
119
+ | `dbDescribeTable` | Get column schema | Before querying |
120
+ | `dbQuery` | Execute SELECT query | Data retrieval |
121
+
122
+ ---
123
+
124
+ ## 3. Table Tools Decision Tree
125
+
126
+ ### When to Use
127
+ - User provides Excel (.xlsx), CSV, or ODS file
128
+ - Need to analyze, filter, or transform tabular data
129
+ - Data exists in local file system
130
+
131
+ ### Row Count Decision Matrix
132
+
133
+ ```
134
+ IF rows < 30:
135
+ → Use table tools directly (fastest)
136
+ - tableFilterRows() for filtering
137
+ - tableGroupBy() for aggregation
138
+ - tableSummarize() for statistics
139
+ - tablePivotSummary() for cross-tabs
140
+
141
+ IF rows >= 30 AND rows < 1000:
142
+ → Decision based on complexity:
143
+ IF need structured summarization with JSON schema:
144
+ → Load skill 'long-table-summary'
145
+ ELSE:
146
+ → Use table tools directly
147
+
148
+ IF rows >= 1000:
149
+ → Decision based on complexity:
150
+ IF need structured summarization:
151
+ → Load skill 'long-table-summary'
152
+ ELSE IF need complex transformations:
153
+ → Write custom Python script
154
+ ELSE:
155
+ → Use table tools with targeted operations
156
+ ```
157
+
158
+ ### Workflow
159
+
160
+ ```
161
+ IF user provides Excel/CSV file:
162
+
163
+ Step 1: Preview Structure
164
+ tableListSheets(file_path) → See available sheets
165
+ tableGetSheetPreview(file_path) → First 6 rows
166
+ tableGetHeaders(file_path) → Column names
167
+
168
+ Step 2: Determine Row Count
169
+ tableGetRange(file_path, range="A1:A10000")
170
+ → Count non-empty rows
171
+
172
+ Step 3: Choose Analysis Approach (see decision matrix above)
173
+
174
+ Step 4: Apply Upfront Filtering (BEST PRACTICE)
175
+ ✅ DO: tableFilterRows(
176
+ file_path,
177
+ column="Status",
178
+ operator="=",
179
+ value="Active"
180
+ )
181
+
182
+ ❌ DON'T: Load entire table then filter in Python
183
+ ```
184
+
185
+ ### Upfront Filtering Examples
186
+
187
+ ```markdown
188
+ # Filter by single condition
189
+ tableFilterRows(file, column="Phase", operator="=", value="Phase 3")
190
+
191
+ # Filter by numeric range
192
+ tableFilterRows(file, column="Age", operator=">=", value=18)
193
+
194
+ # Filter by text contains
195
+ tableFilterRows(file, column="Condition", operator="contains", value="melanoma")
196
+ ```
197
+
198
+ ### Tool Reference
199
+
200
+ | Tool | Purpose | When to Use |
201
+ |------|---------|-------------|
202
+ | `tableListSheets` | List worksheet names | Multi-sheet workbooks |
203
+ | `tableGetSheetPreview` | Preview first 6 rows | Understand structure |
204
+ | `tableGetHeaders` | Get column names | Identify available fields |
205
+ | `tableFilterRows` | Filter by condition | Extract subsets |
206
+ | `tableSearch` | Search across all cells | Find specific values |
207
+ | `tableSummarize` | Statistical summary | Numeric analysis |
208
+ | `tableGroupBy` | Group and aggregate | Categorical analysis |
209
+ | `tablePivotSummary` | Cross-tabulation | Multi-dimensional analysis |
210
+ | `tableGetRange` | Extract data range | Bulk data retrieval |
211
+ | `tableCreateFile` | Create new table | Output generation |
212
+ | `tableAppendRows` | Append rows | Data combination |
213
+
214
+ ---
215
+
216
+ ## 4. BioMCP Tools Decision Tree
217
+
218
+ ### When to Use
219
+ - Biomedical research queries
220
+ - Literature search
221
+ - Clinical trial data
222
+ - Gene/variant/drug information
223
+ - FDA regulatory data
224
+
225
+ ### Domain Selection
226
+
227
+ ```
228
+ IF biomedical research query:
229
+
230
+ Determine Domain:
231
+
232
+ ├─ Literature/Papers
233
+ │ → biomcp_article_searcher(keywords, genes, diseases)
234
+ │ → biomcp_article_getter(pmid)
235
+
236
+ ├─ Clinical Trials
237
+ │ → biomcp_trial_searcher(conditions, interventions)
238
+ │ → biomcp_trial_getter(nct_id)
239
+ │ → biomcp_trial_protocol_getter(nct_id)
240
+ │ → biomcp_trial_outcomes_getter(nct_id)
241
+
242
+ ├─ Genes
243
+ │ → biomcp_gene_getter(gene_id_or_symbol)
244
+
245
+ ├─ Variants/Mutations
246
+ │ → biomcp_variant_searcher(gene, significance)
247
+ │ → biomcp_variant_getter(variant_id)
248
+
249
+ ├─ Drugs/Compounds
250
+ │ → biomcp_drug_getter(drug_id_or_name)
251
+
252
+ ├─ FDA Data
253
+ │ → biomcp_openfda_adverse_searcher(drug, reaction)
254
+ │ → biomcp_openfda_label_searcher(name, indication)
255
+ │ → biomcp_openfda_approval_searcher(drug)
256
+
257
+ └─ Cross-Domain Search
258
+ → biomcp_search(query="gene:BRAF AND disease:melanoma")
259
+ ```
260
+
261
+ ### Targeted Queries (BEST PRACTICE)
262
+
263
+ ```
264
+ RULE: Use specific filters to narrow results upfront
265
+
266
+ ✅ DO:
267
+ biomcp_article_searcher(
268
+ genes=["BRAF", "NRAS"],
269
+ diseases=["melanoma"],
270
+ keywords=["treatment resistance"],
271
+ page_size=50
272
+ )
273
+
274
+ ❌ DON'T:
275
+ biomcp_search(query="BRAF")
276
+ → then manually filter through thousands of results
277
+ ```
278
+
279
+ ### Rate Limiting (MANDATORY)
280
+
281
+ ```
282
+ ALWAYS use blockingTimer(0.3) between consecutive biomcp calls
283
+
284
+ FOR each biomcp query:
285
+ result = biomcp_tool(...)
286
+
287
+ IF more queries remain:
288
+ blockingTimer(0.3) # 300ms delay
289
+
290
+ NEVER run concurrent biomcp calls (sequential only)
291
+ ```
292
+
293
+ ### Example: Literature Research Workflow
294
+
295
+ ```markdown
296
+ User: "Find recent papers on BRAF V600E treatment resistance in melanoma"
297
+
298
+ Agent actions:
299
+ 1. biomcp_article_searcher(
300
+ genes=["BRAF"],
301
+ diseases=["melanoma"],
302
+ variants=["V600E"],
303
+ keywords=["treatment resistance"],
304
+ page_size=20
305
+ )
306
+ 2. blockingTimer(0.3)
307
+ 3. FOR each relevant article:
308
+ biomcp_article_getter(pmid=article.id)
309
+ blockingTimer(0.3)
310
+ 4. Synthesize findings with citations
311
+ ```
312
+
313
+ ---
314
+
315
+ ## 5. Web Tools Decision Tree
316
+
317
+ ### When to Use
318
+ - User provides specific URL
319
+ - Need current information from web
320
+ - Official biotech/pharma company data
321
+ - Information not available in databases
322
+
323
+ ### Search vs Fetch
324
+
325
+ ```
326
+ IF user provides specific URL:
327
+ → web-reader_webReader(url, return_format="markdown")
328
+ → Extract content
329
+
330
+ IF user needs to find information:
331
+ → web-search-prime_web_search_prime(search_query)
332
+ → Identify relevant URLs
333
+ → web-reader_webReader(url) for promising results
334
+ ```
335
+
336
+ ### Source Quality Verification
337
+
338
+ ```
339
+ Source Priority:
340
+ ✅ PREFER (High Quality):
341
+ - .gov domains (FDA, NIH, NCI)
342
+ - Official biotech/pharma company websites
343
+ - Peer-reviewed journal websites
344
+ - ClinicalTrials.gov
345
+
346
+ ⚠️ CAUTION (Medium Quality):
347
+ - News websites (verify with primary sources)
348
+ - Industry publications
349
+ - Conference abstracts
350
+
351
+ ❌ AVOID (Low Quality):
352
+ - Blogs and forums
353
+ - User-generated content
354
+ - Promotional materials
355
+ - Unverified claims
356
+ ```
357
+
358
+ ### Rate Limiting
359
+
360
+ ```
361
+ FOR each web request:
362
+ result = webfetch(...)
363
+
364
+ IF more requests remain:
365
+ blockingTimer(0.5) # 500ms delay (more conservative)
366
+ ```
367
+
368
+ ---
369
+
370
+ ## 6. Parser Tools Decision Tree
371
+
372
+ ### When to Use
373
+ - Need to parse structured file formats
374
+ - Convert between formats
375
+ - Process ontology files
376
+
377
+ ### Tool Selection
378
+
379
+ ```
380
+ IF file is PubMed XML (.xml or .xml.gz):
381
+ → parse_pubmed_articleSet(
382
+ filePath,
383
+ outputMode="excel", # or "single" or "individual"
384
+ outputFileName="pubmed_results.xlsx"
385
+ )
386
+
387
+ IF file is OBO ontology (.obo):
388
+ → parse_obo_file(
389
+ filePath,
390
+ outputFileName="ontology.csv"
391
+ )
392
+
393
+ IF file is JSON:
394
+ → jsonExtract(file_path)
395
+ → jsonValidate(data, schema) if needed
396
+ ```
397
+
398
+ ---
399
+
400
+ ## 7. Decision Flowchart Summary
401
+
402
+ ```
403
+ START: User Query
404
+
405
+ ├─ Analyze user intent
406
+
407
+ ├─ Identify data source
408
+ │ ├─ Database → db* tools
409
+ │ ├─ Table file → table* tools
410
+ │ ├─ Web → web* tools
411
+ │ ├─ Biomedical → biomcp* tools
412
+ │ └─ Parse needed → parse* tools
413
+
414
+ ├─ Apply upfront filtering
415
+ │ └─ Use targeted queries/filters
416
+
417
+ ├─ Execute with rate limiting
418
+ │ └─ blockingTimer between API calls
419
+
420
+ ├─ Validate results
421
+ │ └─ Check data quality
422
+
423
+ └─ Synthesize with citations
424
+ └─ Reference-based report
425
+ ```
426
+
427
+ ---
428
+
429
+ ## Best Practices Summary
430
+
431
+ ### ✅ DO
432
+ - Use targeted queries with specific filters
433
+ - Apply upfront filtering at data source
434
+ - Use named parameters in SQL queries
435
+ - Implement rate limiting between API calls
436
+ - Validate data before processing
437
+ - Use decision trees to select tools
438
+
439
+ ### ❌ DON'T
440
+ - Use bulk queries then filter in Python
441
+ - Concatenate SQL strings
442
+ - Run concurrent API calls
443
+ - Skip rate limiting
444
+ - Load entire datasets without filtering
445
+ - Guess tool choices without analysis
446
+
447
+ ---
448
+
449
+ ## Common Patterns
450
+
451
+ ### Pattern 1: Database → Analysis
452
+ ```
453
+ dbListTables()
454
+ → dbDescribeTable()
455
+ → dbQuery(with filters)
456
+ → analysis
457
+ ```
458
+
459
+ ### Pattern 2: Literature Search
460
+ ```
461
+ biomcp_article_searcher(filters)
462
+ → blockingTimer(0.3)
463
+ → biomcp_article_getter(pmid)
464
+ → repeat
465
+ ```
466
+
467
+ ### Pattern 3: Table Analysis
468
+ ```
469
+ tableGetSheetPreview()
470
+ → determine row count
471
+ → choose approach
472
+ → execute
473
+ ```
474
+
475
+ ### Pattern 4: Web Research
476
+ ```
477
+ web-search-prime()
478
+ → identify URLs
479
+ → web-reader_webReader()
480
+ → extract data
481
+ ```
@@ -0,0 +1,234 @@
1
+ # Citations Pattern
2
+
3
+ Standardized citation format for biomedical research with automatic bibliography generation.
4
+
5
+ ## Overview
6
+
7
+ Use this pattern to maintain consistent citations throughout research outputs. All findings must be backed by sources with proper citations.
8
+
9
+ ## Citation Style
10
+
11
+ Use **numbered citations** for biomedical research:
12
+
13
+ - In-text: [1], [2], [3]
14
+ - Bibliography: Numbered list at end of document
15
+
16
+ ## In-Text Citation Format
17
+
18
+ ### Single Source
19
+ ```
20
+ BRAF V600E mutations are found in approximately 50% of melanomas [1].
21
+ ```
22
+
23
+ ### Multiple Sources
24
+ ```
25
+ Several studies have confirmed this association [1, 2, 3].
26
+ ```
27
+
28
+ ### Range of Sources
29
+ ```
30
+ This has been extensively documented [1-5].
31
+ ```
32
+
33
+ ### Specific Claims
34
+ ```
35
+ The drug was approved in 2011 [1] and has since become standard of care [2, 3].
36
+ ```
37
+
38
+ ## Bibliography Format
39
+
40
+ ### PubMed Articles
41
+
42
+ ```
43
+ [1] Author1 AB, Author2 CD, Author3 EF. Article Title. Journal Name. Year;Volume(Issue):Pages. PMID: XXXXXXXX.
44
+ ```
45
+
46
+ **Example:**
47
+ ```
48
+ [1] Chapman PB, Hauschild A, Robert C, et al. Improved survival with vemurafenib in melanoma with BRAF V600E mutation. N Engl J Med. 2011;364(26):2507-2516. PMID: 21639808.
49
+ ```
50
+
51
+ ### Clinical Trials
52
+
53
+ ```
54
+ [N] NCT ID: Trial Title. Phase X. Sponsor: Company/Institution. Status: Recruiting/Completed. URL: https://clinicaltrials.gov/ct2/show/NCTXXXXXXX
55
+ ```
56
+
57
+ **Example:**
58
+ ```
59
+ [2] NCT04280705: A Study of Encorafenib Plus Cetuximab With or Without Nivolumab in Metastatic Colorectal Cancer. Phase 2. Sponsor: Pfizer. Status: Completed. https://clinicaltrials.gov/ct2/show/NCT04280705
60
+ ```
61
+
62
+ ### Web Sources
63
+
64
+ ```
65
+ [N] Page Title. Website Name. Published/Updated Date. URL. Accessed: YYYY-MM-DD.
66
+ ```
67
+
68
+ **Example:**
69
+ ```
70
+ [3] BRAF Gene. National Cancer Institute. Updated 2024. https://www.cancer.gov/about-cancer/causes-prevention/genetics/brca-genes. Accessed: 2024-01-15.
71
+ ```
72
+
73
+ ### Drug/Chemical Information
74
+
75
+ ```
76
+ [N] Drug Name. DrugBank ID: DBXXXXX. ChEMBL ID: CHEMBLXXXXX. Indication: Disease.
77
+ ```
78
+
79
+ **Example:**
80
+ ```
81
+ [4] Vemurafenib. DrugBank ID: DB08881. ChEMBL ID: CHEMBL1229511. Indication: Melanoma.
82
+ ```
83
+
84
+ ### Gene Information
85
+
86
+ ```
87
+ [N] Gene Symbol: Gene Name. Entrez ID: XXXXXX. HGNC ID: HGNC:XXXX.
88
+ ```
89
+
90
+ **Example:**
91
+ ```
92
+ [5] BRAF: B-Raf proto-oncogene, serine/threonine kinase. Entrez ID: 673. HGNC ID: HGNC:1097.
93
+ ```
94
+
95
+ ## Source-Specific Citation Workflows
96
+
97
+ ### From BioMCP Article Results
98
+
99
+ When using `biomcp_search` or `biomcp_article_searcher`:
100
+
101
+ ```
102
+ 1. Extract from result:
103
+ - Authors (first author + "et al." if many)
104
+ - Title
105
+ - Journal
106
+ - Year
107
+ - PMID (from result.id or result.metadata)
108
+
109
+ 2. Use biomcp_article_getter(pmid="XXXXXXXX") for full metadata if needed
110
+
111
+ 3. Format citation
112
+ ```
113
+
114
+ ### From Clinical Trials
115
+
116
+ When using `biomcp_trial_searcher` or `biomcp_trial_getter`:
117
+
118
+ ```
119
+ 1. Extract from result:
120
+ - NCT ID (result.id)
121
+ - Official title
122
+ - Phase
123
+ - Sponsor
124
+ - Status
125
+
126
+ 2. Format citation with ClinicalTrials.gov URL
127
+ ```
128
+
129
+ ### From Gene/Drug/Variant Information
130
+
131
+ When using gene_getter, drug_getter, or variant_getter:
132
+
133
+ ```
134
+ 1. Extract identifiers:
135
+ - Gene: Symbol, Entrez ID, HGNC ID
136
+ - Drug: Name, DrugBank ID, ChEMBL ID
137
+ - Variant: HGVS notation, rsID, ClinVar significance
138
+
139
+ 2. Format as database citation
140
+ ```
141
+
142
+ ## Bibliography Section Format
143
+
144
+ Place bibliography at the end of your document:
145
+
146
+ ```markdown
147
+ ## References
148
+
149
+ [1] Chapman PB, Hauschild A, Robert C, et al. Improved survival with vemurafenib in melanoma with BRAF V600E mutation. N Engl J Med. 2011;364(26):2507-2516. PMID: 21639808.
150
+
151
+ [2] NCT04280705: A Study of Encorafenib Plus Cetuximab With or Without Nivolumab in Metastatic Colorectal Cancer. Phase 2. Sponsor: Pfizer. Status: Completed. https://clinicaltrials.gov/ct2/show/NCT04280705
152
+
153
+ [3] BRAF Gene. National Cancer Institute. Updated 2024. https://www.cancer.gov/about-cancer/causes-prevention/genetics/brca-genes. Accessed: 2024-01-15.
154
+ ```
155
+
156
+ ## Example: Research Report with Citations
157
+
158
+ ```markdown
159
+ # BRAF Mutations in Melanoma
160
+
161
+ ## Overview
162
+
163
+ BRAF V600E is the most common mutation in cutaneous melanoma, occurring in approximately 50% of cases [1]. This mutation leads to constitutive activation of the MAPK signaling pathway [2].
164
+
165
+ ## Treatment Landscape
166
+
167
+ Targeted therapies against BRAF V600E have significantly improved outcomes:
168
+
169
+ - **Vemurafenib**: First FDA-approved BRAF inhibitor (2011) [3]
170
+ - **Dabrafenib**: Second-generation BRAF inhibitor [4]
171
+ - **Combination therapy**: BRAF + MEK inhibition improves survival [5]
172
+
173
+ ## Clinical Trials
174
+
175
+ Several ongoing trials are exploring combination approaches:
176
+
177
+ - NCT04280705: Encorafenib + cetuximab ± nivolumab in colorectal cancer [6]
178
+ - NCT04511078: Adjuvant dabrafenib + trametinib in melanoma [7]
179
+
180
+ ## References
181
+
182
+ [1] Davies H, Bignell GR, Cox C, et al. Mutations of the BRAF gene in human cancer. Nature. 2002;417(6892):949-954. PMID: 12068308.
183
+
184
+ [2] Wan PT, Garnett MJ, Roe SM, et al. Mechanism of activation of RAF-ERK signaling by oncogenic mutations of B-RAF. Cell. 2004;116(6):855-867. PMID: 15035987.
185
+
186
+ [3] Chapman PB, Hauschild A, Robert C, et al. Improved survival with vemurafenib in melanoma with BRAF V600E mutation. N Engl J Med. 2011;364(26):2507-2516. PMID: 21639808.
187
+
188
+ [4] Hauschild A, Grob JJ, Demidov LV, et al. Dabrafenib in BRAF-mutated metastatic melanoma: a multicentre, open-label, phase 3 randomised controlled trial. Lancet. 2012;380(9839):358-365. PMID: 22735384.
189
+
190
+ [5] Robert C, Karaszewska B, Schachter J, et al. Improved overall survival in melanoma with combined dabrafenib and trametinib. N Engl J Med. 2015;372(1):30-39. PMID: 25399551.
191
+
192
+ [6] NCT04280705: A Study of Encorafenib Plus Cetuximab With or Without Nivolumab in Metastatic Colorectal Cancer. Phase 2. Sponsor: Pfizer. Status: Completed. https://clinicaltrials.gov/ct2/show/NCT04280705
193
+
194
+ [7] NCT04511078: Adjuvant Dabrafenib Plus Trametinib in Resected BRAF V600-Mutant Melanoma. Phase 3. Sponsor: Novartis. Status: Recruiting. https://clinicaltrials.gov/ct2/show/NCT04511078
195
+ ```
196
+
197
+ ## Citation Quality Standards
198
+
199
+ ### What to Cite
200
+
201
+ | Source Type | Citation Required |
202
+ |-------------|-------------------|
203
+ | Published research | Yes |
204
+ | Clinical trial data | Yes |
205
+ | Drug approval info | Yes |
206
+ | Gene/variant annotations | Yes |
207
+ | Statistical claims | Yes |
208
+ | Direct quotes | Yes |
209
+ | General knowledge | No (e.g., "DNA has 4 bases") |
210
+
211
+ ### Citation Integrity
212
+
213
+ 1. **Verify source exists**: Always confirm PMID, NCT ID, URL is valid
214
+ 2. **Quote accurately**: Don't misrepresent findings
215
+ 3. **Cite primary sources**: Prefer original papers over reviews
216
+ 4. **Update outdated citations**: Use latest evidence when available
217
+
218
+ ## Tools for Citation Generation
219
+
220
+ | Tool | Use Case |
221
+ |------|----------|
222
+ | `biomcp_article_getter` | Get full article metadata from PMID |
223
+ | `biomcp_trial_getter` | Get trial details from NCT ID |
224
+ | `biomcp_gene_getter` | Get gene identifiers |
225
+ | `biomcp_drug_getter` | Get drug identifiers |
226
+
227
+ ## Best Practices
228
+
229
+ 1. **Cite as you write**: Add citations immediately when making claims
230
+ 2. **Number sequentially**: [1], [2], [3] in order of appearance
231
+ 3. **Include access dates**: For web sources, always include when accessed
232
+ 4. **Verify PMIDs**: Double-check PMID matches the article
233
+ 5. **Keep bibliography alphabetical by number**: Not by author
234
+ 6. **Format consistently**: Same style throughout document