@cyanheads/pubmed-mcp-server 1.0.12
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/LICENSE +201 -0
- package/README.md +174 -0
- package/dist/config/index.d.ts +91 -0
- package/dist/config/index.js +324 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +190 -0
- package/dist/mcp-server/resources/echoResource/echoResourceLogic.d.ts +79 -0
- package/dist/mcp-server/resources/echoResource/echoResourceLogic.js +82 -0
- package/dist/mcp-server/resources/echoResource/index.d.ts +13 -0
- package/dist/mcp-server/resources/echoResource/index.js +13 -0
- package/dist/mcp-server/resources/echoResource/registration.d.ts +30 -0
- package/dist/mcp-server/resources/echoResource/registration.js +168 -0
- package/dist/mcp-server/server.d.ts +28 -0
- package/dist/mcp-server/server.js +159 -0
- package/dist/mcp-server/tools/fetchPubMedContent/index.d.ts +6 -0
- package/dist/mcp-server/tools/fetchPubMedContent/index.js +6 -0
- package/dist/mcp-server/tools/fetchPubMedContent/logic.d.ts +63 -0
- package/dist/mcp-server/tools/fetchPubMedContent/logic.js +518 -0
- package/dist/mcp-server/tools/fetchPubMedContent/registration.d.ts +10 -0
- package/dist/mcp-server/tools/fetchPubMedContent/registration.js +37 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/index.d.ts +6 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/index.js +6 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic/citationFormatter.d.ts +9 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic/citationFormatter.js +288 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic/elinkHandler.d.ts +9 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic/elinkHandler.js +208 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic/index.d.ts +15 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic/index.js +82 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic/types.d.ts +27 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic/types.js +5 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic.d.ts +6 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/logic.js +6 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/registration.d.ts +36 -0
- package/dist/mcp-server/tools/getPubMedArticleConnections/registration.js +76 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/index.d.ts +6 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/index.js +6 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/logic/index.d.ts +7 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/logic/index.js +9 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/logic/inputSchema.d.ts +111 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/logic/inputSchema.js +149 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/logic/outputTypes.d.ts +106 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/logic/outputTypes.js +7 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/logic/planOrchestrator.d.ts +10 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/logic/planOrchestrator.js +251 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/logic.d.ts +12 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/logic.js +55 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/registration.d.ts +10 -0
- package/dist/mcp-server/tools/pubmedResearchAgent/registration.js +36 -0
- package/dist/mcp-server/tools/searchPubMedArticles/index.d.ts +6 -0
- package/dist/mcp-server/tools/searchPubMedArticles/index.js +6 -0
- package/dist/mcp-server/tools/searchPubMedArticles/logic.d.ts +61 -0
- package/dist/mcp-server/tools/searchPubMedArticles/logic.js +229 -0
- package/dist/mcp-server/tools/searchPubMedArticles/registration.d.ts +10 -0
- package/dist/mcp-server/tools/searchPubMedArticles/registration.js +38 -0
- package/dist/mcp-server/transports/authentication/authMiddleware.d.ts +29 -0
- package/dist/mcp-server/transports/authentication/authMiddleware.js +174 -0
- package/dist/mcp-server/transports/httpTransport.d.ts +23 -0
- package/dist/mcp-server/transports/httpTransport.js +463 -0
- package/dist/mcp-server/transports/stdioTransport.d.ts +42 -0
- package/dist/mcp-server/transports/stdioTransport.js +63 -0
- package/dist/services/NCBI/ncbiConstants.d.ts +22 -0
- package/dist/services/NCBI/ncbiConstants.js +5 -0
- package/dist/services/NCBI/ncbiCoreApiClient.d.ts +24 -0
- package/dist/services/NCBI/ncbiCoreApiClient.js +118 -0
- package/dist/services/NCBI/ncbiRequestQueueManager.d.ts +36 -0
- package/dist/services/NCBI/ncbiRequestQueueManager.js +96 -0
- package/dist/services/NCBI/ncbiResponseHandler.d.ts +22 -0
- package/dist/services/NCBI/ncbiResponseHandler.js +192 -0
- package/dist/services/NCBI/ncbiService.d.ts +24 -0
- package/dist/services/NCBI/ncbiService.js +57 -0
- package/dist/services/index.d.ts +7 -0
- package/dist/services/index.js +7 -0
- package/dist/services/llm-providers/index.d.ts +7 -0
- package/dist/services/llm-providers/index.js +7 -0
- package/dist/services/llm-providers/llmFactory.d.ts +69 -0
- package/dist/services/llm-providers/llmFactory.js +132 -0
- package/dist/services/llm-providers/openRouter/index.d.ts +6 -0
- package/dist/services/llm-providers/openRouter/index.js +7 -0
- package/dist/services/llm-providers/openRouter/openRouterProvider.d.ts +99 -0
- package/dist/services/llm-providers/openRouter/openRouterProvider.js +329 -0
- package/dist/types-global/errors.d.ts +119 -0
- package/dist/types-global/errors.js +119 -0
- package/dist/types-global/pubmedXml.d.ts +350 -0
- package/dist/types-global/pubmedXml.js +7 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/index.js +18 -0
- package/dist/utils/internal/errorHandler.d.ts +176 -0
- package/dist/utils/internal/errorHandler.js +335 -0
- package/dist/utils/internal/index.d.ts +9 -0
- package/dist/utils/internal/index.js +9 -0
- package/dist/utils/internal/logger.d.ts +141 -0
- package/dist/utils/internal/logger.js +426 -0
- package/dist/utils/internal/requestContext.d.ts +83 -0
- package/dist/utils/internal/requestContext.js +72 -0
- package/dist/utils/metrics/index.d.ts +7 -0
- package/dist/utils/metrics/index.js +7 -0
- package/dist/utils/metrics/tokenCounter.d.ts +35 -0
- package/dist/utils/metrics/tokenCounter.js +110 -0
- package/dist/utils/parsing/dateParser.d.ts +73 -0
- package/dist/utils/parsing/dateParser.js +107 -0
- package/dist/utils/parsing/index.d.ts +8 -0
- package/dist/utils/parsing/index.js +8 -0
- package/dist/utils/parsing/jsonParser.d.ts +82 -0
- package/dist/utils/parsing/jsonParser.js +126 -0
- package/dist/utils/parsing/ncbi-parsing/eSummaryResultParser.d.ts +32 -0
- package/dist/utils/parsing/ncbi-parsing/eSummaryResultParser.js +295 -0
- package/dist/utils/parsing/ncbi-parsing/index.d.ts +8 -0
- package/dist/utils/parsing/ncbi-parsing/index.js +8 -0
- package/dist/utils/parsing/ncbi-parsing/pubmedArticleStructureParser.d.ts +70 -0
- package/dist/utils/parsing/ncbi-parsing/pubmedArticleStructureParser.js +229 -0
- package/dist/utils/parsing/ncbi-parsing/xmlGenericHelpers.d.ts +31 -0
- package/dist/utils/parsing/ncbi-parsing/xmlGenericHelpers.js +76 -0
- package/dist/utils/security/idGenerator.d.ts +134 -0
- package/dist/utils/security/idGenerator.js +198 -0
- package/dist/utils/security/index.d.ts +9 -0
- package/dist/utils/security/index.js +9 -0
- package/dist/utils/security/rateLimiter.d.ts +108 -0
- package/dist/utils/security/rateLimiter.js +179 -0
- package/dist/utils/security/sanitization.d.ts +173 -0
- package/dist/utils/security/sanitization.js +439 -0
- package/package.json +97 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Registers the 'get_pubmed_article_connections' tool with the MCP server.
|
|
3
|
+
* This tool finds articles related to a source PMID or retrieves citation formats.
|
|
4
|
+
* @module src/mcp-server/tools/getPubMedArticleConnections/registration
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
/**
|
|
9
|
+
* Zod schema for the input parameters of the 'get_pubmed_article_connections' tool.
|
|
10
|
+
*/
|
|
11
|
+
export declare const GetPubMedArticleConnectionsInputSchema: z.ZodObject<{
|
|
12
|
+
sourcePmid: z.ZodString;
|
|
13
|
+
relationshipType: z.ZodDefault<z.ZodEnum<["pubmed_similar_articles", "pubmed_citedin", "pubmed_references", "citation_formats"]>>;
|
|
14
|
+
maxRelatedResults: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
15
|
+
citationStyles: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<["ris", "bibtex", "apa_string", "mla_string"]>, "many">>>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
sourcePmid: string;
|
|
18
|
+
relationshipType: "pubmed_similar_articles" | "pubmed_citedin" | "pubmed_references" | "citation_formats";
|
|
19
|
+
maxRelatedResults: number;
|
|
20
|
+
citationStyles: ("ris" | "bibtex" | "apa_string" | "mla_string")[];
|
|
21
|
+
}, {
|
|
22
|
+
sourcePmid: string;
|
|
23
|
+
relationshipType?: "pubmed_similar_articles" | "pubmed_citedin" | "pubmed_references" | "citation_formats" | undefined;
|
|
24
|
+
maxRelatedResults?: number | undefined;
|
|
25
|
+
citationStyles?: ("ris" | "bibtex" | "apa_string" | "mla_string")[] | undefined;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Type alias for the validated input of the 'get_pubmed_article_connections' tool.
|
|
29
|
+
*/
|
|
30
|
+
export type GetPubMedArticleConnectionsInput = z.infer<typeof GetPubMedArticleConnectionsInputSchema>;
|
|
31
|
+
/**
|
|
32
|
+
* Registers the 'get_pubmed_article_connections' tool with the given MCP server instance.
|
|
33
|
+
* @param {McpServer} server - The MCP server instance.
|
|
34
|
+
* @param {RequestContext} registrationContext - The context for this registration operation.
|
|
35
|
+
*/
|
|
36
|
+
export declare function registerGetPubMedArticleConnectionsTool(server: McpServer): void;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Registers the 'get_pubmed_article_connections' tool with the MCP server.
|
|
3
|
+
* This tool finds articles related to a source PMID or retrieves citation formats.
|
|
4
|
+
* @module src/mcp-server/tools/getPubMedArticleConnections/registration
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { BaseErrorCode, McpError } from "../../../types-global/errors.js"; // Import McpError
|
|
8
|
+
import { ErrorHandler, requestContextService, } from "../../../utils/index.js"; // Import requestContextService
|
|
9
|
+
import { handleGetPubMedArticleConnections } from "./logic.js";
|
|
10
|
+
/**
|
|
11
|
+
* Zod schema for the input parameters of the 'get_pubmed_article_connections' tool.
|
|
12
|
+
*/
|
|
13
|
+
export const GetPubMedArticleConnectionsInputSchema = z.object({
|
|
14
|
+
sourcePmid: z
|
|
15
|
+
.string()
|
|
16
|
+
.regex(/^\d+$/)
|
|
17
|
+
.describe("The PubMed Unique Identifier (PMID) of the source article for which to find connections or format citations. This PMID must be a valid number string."),
|
|
18
|
+
relationshipType: z
|
|
19
|
+
.enum([
|
|
20
|
+
"pubmed_similar_articles",
|
|
21
|
+
"pubmed_citedin",
|
|
22
|
+
"pubmed_references",
|
|
23
|
+
"citation_formats",
|
|
24
|
+
])
|
|
25
|
+
.default("pubmed_similar_articles")
|
|
26
|
+
.describe("Specifies the type of connection or action: \n- 'pubmed_similar_articles': Finds articles similar to the source PMID (uses ELink `cmd=neighbor`). \n- 'pubmed_citedin': Finds articles in PubMed that cite the source PMID (uses ELink `linkname=pubmed_pubmed_citedin`). \n- 'pubmed_references': Finds articles in PubMed referenced by the source PMID (uses ELink `linkname=pubmed_pubmed_refs`). \n- 'citation_formats': Retrieves data for the source PMID and formats it into specified citation styles (uses EFetch)."),
|
|
27
|
+
maxRelatedResults: z
|
|
28
|
+
.number()
|
|
29
|
+
.int()
|
|
30
|
+
.positive()
|
|
31
|
+
.max(50, "Maximum 50 related results can be requested.")
|
|
32
|
+
.optional()
|
|
33
|
+
.default(5)
|
|
34
|
+
.describe("Maximum number of related articles to retrieve when 'relationshipType' is 'pubmed_similar_articles', 'pubmed_citedin', or 'pubmed_references'. ELink results from NCBI will be truncated by the server if they exceed this number. Default is 5, maximum is 50."),
|
|
35
|
+
citationStyles: z
|
|
36
|
+
.array(z.enum(["ris", "bibtex", "apa_string", "mla_string"]))
|
|
37
|
+
.optional()
|
|
38
|
+
.default(["ris"])
|
|
39
|
+
.describe("An array of citation styles to format the source article into when 'relationshipType' is 'citation_formats'. Supported styles: 'ris', 'bibtex', 'apa_string', 'mla_string'. Default is ['ris']. Formatting is performed server-side based on data fetched via EFetch."),
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Registers the 'get_pubmed_article_connections' tool with the given MCP server instance.
|
|
43
|
+
* @param {McpServer} server - The MCP server instance.
|
|
44
|
+
* @param {RequestContext} registrationContext - The context for this registration operation.
|
|
45
|
+
*/
|
|
46
|
+
export function registerGetPubMedArticleConnectionsTool(server) {
|
|
47
|
+
const operation = "registerGetPubMedArticleConnectionsTool";
|
|
48
|
+
const registrationContext = requestContextService.createRequestContext({
|
|
49
|
+
operation,
|
|
50
|
+
});
|
|
51
|
+
try {
|
|
52
|
+
server.tool("get_pubmed_article_connections", "Finds articles related to a source PubMed ID (PMID) or retrieves formatted citations for it. Supports finding similar articles, articles that cite the source, articles referenced by the source (via NCBI ELink), or fetching data to generate citations in various styles (RIS, BibTeX, APA, MLA via NCBI EFetch and server-side formatting). Returns a JSON object detailing the connections or formatted citations.", GetPubMedArticleConnectionsInputSchema.shape, // Pass .shape
|
|
53
|
+
async (validatedInput, toolContext) => {
|
|
54
|
+
// Create a new rich context for the logic handler
|
|
55
|
+
const richLogicContext = requestContextService.createRequestContext({
|
|
56
|
+
parentRequestId: registrationContext.requestId, // Link to registration context
|
|
57
|
+
operation: "getPubMedArticleConnectionsToolHandler",
|
|
58
|
+
mcpToolContext: toolContext, // Include MCP-provided context
|
|
59
|
+
});
|
|
60
|
+
return await handleGetPubMedArticleConnections(validatedInput, richLogicContext);
|
|
61
|
+
});
|
|
62
|
+
// Consistent with other tools, explicit success logging here might be omitted,
|
|
63
|
+
// relying on ErrorHandler for issues or higher-level logging.
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
ErrorHandler.handleError(new McpError(// Create an McpError for consistent handling
|
|
67
|
+
BaseErrorCode.INITIALIZATION_FAILED, "Failed to register 'get_pubmed_article_connections' tool.", {
|
|
68
|
+
originalError: error instanceof Error ? error.message : String(error),
|
|
69
|
+
}), {
|
|
70
|
+
operation,
|
|
71
|
+
context: registrationContext, // Use the context of the registration operation
|
|
72
|
+
errorCode: BaseErrorCode.INITIALIZATION_FAILED,
|
|
73
|
+
critical: true, // Registration failure is critical
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Barrel export file for the pubmed_research_agent tool's core logic.
|
|
3
|
+
* @module pubmedResearchAgent/logic/index
|
|
4
|
+
*/
|
|
5
|
+
export * from "./inputSchema.js";
|
|
6
|
+
export * from "./outputTypes.js";
|
|
7
|
+
export * from "./planOrchestrator.js";
|
|
8
|
+
// Individual section prompt generators are not typically exported directly from here,
|
|
9
|
+
// as they are used internally by the planOrchestrator.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Defines the Zod input schema and TypeScript types for the pubmed_research_agent tool.
|
|
3
|
+
* This schema accepts detailed components of a research plan from the client,
|
|
4
|
+
* which the tool will then structure into a standardized output format.
|
|
5
|
+
* @module pubmedResearchAgent/logic/inputSchema
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
export declare const PubMedResearchAgentInputSchema: z.ZodObject<{
|
|
9
|
+
project_title_suggestion: z.ZodString;
|
|
10
|
+
primary_research_goal: z.ZodString;
|
|
11
|
+
research_keywords: z.ZodArray<z.ZodString, "many">;
|
|
12
|
+
organism_focus: z.ZodOptional<z.ZodString>;
|
|
13
|
+
p1_introduction_and_background: z.ZodOptional<z.ZodString>;
|
|
14
|
+
p1_specific_research_question: z.ZodOptional<z.ZodString>;
|
|
15
|
+
p1_knowledge_gap: z.ZodOptional<z.ZodString>;
|
|
16
|
+
p1_primary_hypothesis: z.ZodOptional<z.ZodString>;
|
|
17
|
+
p1_secondary_questions_or_hypotheses: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
18
|
+
p1_pubmed_search_strategy_description: z.ZodOptional<z.ZodString>;
|
|
19
|
+
p1_literature_review_scope: z.ZodOptional<z.ZodString>;
|
|
20
|
+
p1_lit_review_databases_and_approach: z.ZodOptional<z.ZodString>;
|
|
21
|
+
p1_experimental_paradigm: z.ZodOptional<z.ZodString>;
|
|
22
|
+
p1_data_acquisition_plan_existing_data: z.ZodOptional<z.ZodString>;
|
|
23
|
+
p1_data_acquisition_plan_new_data: z.ZodOptional<z.ZodString>;
|
|
24
|
+
p1_blast_utilization_plan: z.ZodOptional<z.ZodString>;
|
|
25
|
+
p1_controls_and_rigor: z.ZodOptional<z.ZodString>;
|
|
26
|
+
p1_methodological_challenges_and_mitigation: z.ZodOptional<z.ZodString>;
|
|
27
|
+
p2_data_collection_methods_wet_lab: z.ZodOptional<z.ZodString>;
|
|
28
|
+
p2_data_collection_methods_dry_lab: z.ZodOptional<z.ZodString>;
|
|
29
|
+
p2_data_preprocessing_and_qc_plan: z.ZodOptional<z.ZodString>;
|
|
30
|
+
p3_data_analysis_strategy: z.ZodOptional<z.ZodString>;
|
|
31
|
+
p3_bioinformatics_pipeline_summary: z.ZodOptional<z.ZodString>;
|
|
32
|
+
p3_results_interpretation_framework: z.ZodOptional<z.ZodString>;
|
|
33
|
+
p3_comparison_with_literature_plan: z.ZodOptional<z.ZodString>;
|
|
34
|
+
p4_dissemination_manuscript_plan: z.ZodOptional<z.ZodString>;
|
|
35
|
+
p4_dissemination_data_deposition_plan: z.ZodOptional<z.ZodString>;
|
|
36
|
+
p4_peer_review_and_publication_approach: z.ZodOptional<z.ZodString>;
|
|
37
|
+
p4_future_research_directions: z.ZodOptional<z.ZodString>;
|
|
38
|
+
cc_record_keeping_and_data_management: z.ZodOptional<z.ZodString>;
|
|
39
|
+
cc_collaboration_strategy: z.ZodOptional<z.ZodString>;
|
|
40
|
+
cc_ethical_considerations: z.ZodOptional<z.ZodString>;
|
|
41
|
+
include_detailed_prompts_for_agent: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
project_title_suggestion: string;
|
|
44
|
+
primary_research_goal: string;
|
|
45
|
+
research_keywords: string[];
|
|
46
|
+
include_detailed_prompts_for_agent: boolean;
|
|
47
|
+
organism_focus?: string | undefined;
|
|
48
|
+
p1_introduction_and_background?: string | undefined;
|
|
49
|
+
p1_specific_research_question?: string | undefined;
|
|
50
|
+
p1_knowledge_gap?: string | undefined;
|
|
51
|
+
p1_primary_hypothesis?: string | undefined;
|
|
52
|
+
p1_secondary_questions_or_hypotheses?: string[] | undefined;
|
|
53
|
+
p1_pubmed_search_strategy_description?: string | undefined;
|
|
54
|
+
p1_literature_review_scope?: string | undefined;
|
|
55
|
+
p1_lit_review_databases_and_approach?: string | undefined;
|
|
56
|
+
p1_experimental_paradigm?: string | undefined;
|
|
57
|
+
p1_data_acquisition_plan_existing_data?: string | undefined;
|
|
58
|
+
p1_data_acquisition_plan_new_data?: string | undefined;
|
|
59
|
+
p1_blast_utilization_plan?: string | undefined;
|
|
60
|
+
p1_controls_and_rigor?: string | undefined;
|
|
61
|
+
p1_methodological_challenges_and_mitigation?: string | undefined;
|
|
62
|
+
p2_data_collection_methods_wet_lab?: string | undefined;
|
|
63
|
+
p2_data_collection_methods_dry_lab?: string | undefined;
|
|
64
|
+
p2_data_preprocessing_and_qc_plan?: string | undefined;
|
|
65
|
+
p3_data_analysis_strategy?: string | undefined;
|
|
66
|
+
p3_bioinformatics_pipeline_summary?: string | undefined;
|
|
67
|
+
p3_results_interpretation_framework?: string | undefined;
|
|
68
|
+
p3_comparison_with_literature_plan?: string | undefined;
|
|
69
|
+
p4_dissemination_manuscript_plan?: string | undefined;
|
|
70
|
+
p4_dissemination_data_deposition_plan?: string | undefined;
|
|
71
|
+
p4_peer_review_and_publication_approach?: string | undefined;
|
|
72
|
+
p4_future_research_directions?: string | undefined;
|
|
73
|
+
cc_record_keeping_and_data_management?: string | undefined;
|
|
74
|
+
cc_collaboration_strategy?: string | undefined;
|
|
75
|
+
cc_ethical_considerations?: string | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
project_title_suggestion: string;
|
|
78
|
+
primary_research_goal: string;
|
|
79
|
+
research_keywords: string[];
|
|
80
|
+
organism_focus?: string | undefined;
|
|
81
|
+
p1_introduction_and_background?: string | undefined;
|
|
82
|
+
p1_specific_research_question?: string | undefined;
|
|
83
|
+
p1_knowledge_gap?: string | undefined;
|
|
84
|
+
p1_primary_hypothesis?: string | undefined;
|
|
85
|
+
p1_secondary_questions_or_hypotheses?: string[] | undefined;
|
|
86
|
+
p1_pubmed_search_strategy_description?: string | undefined;
|
|
87
|
+
p1_literature_review_scope?: string | undefined;
|
|
88
|
+
p1_lit_review_databases_and_approach?: string | undefined;
|
|
89
|
+
p1_experimental_paradigm?: string | undefined;
|
|
90
|
+
p1_data_acquisition_plan_existing_data?: string | undefined;
|
|
91
|
+
p1_data_acquisition_plan_new_data?: string | undefined;
|
|
92
|
+
p1_blast_utilization_plan?: string | undefined;
|
|
93
|
+
p1_controls_and_rigor?: string | undefined;
|
|
94
|
+
p1_methodological_challenges_and_mitigation?: string | undefined;
|
|
95
|
+
p2_data_collection_methods_wet_lab?: string | undefined;
|
|
96
|
+
p2_data_collection_methods_dry_lab?: string | undefined;
|
|
97
|
+
p2_data_preprocessing_and_qc_plan?: string | undefined;
|
|
98
|
+
p3_data_analysis_strategy?: string | undefined;
|
|
99
|
+
p3_bioinformatics_pipeline_summary?: string | undefined;
|
|
100
|
+
p3_results_interpretation_framework?: string | undefined;
|
|
101
|
+
p3_comparison_with_literature_plan?: string | undefined;
|
|
102
|
+
p4_dissemination_manuscript_plan?: string | undefined;
|
|
103
|
+
p4_dissemination_data_deposition_plan?: string | undefined;
|
|
104
|
+
p4_peer_review_and_publication_approach?: string | undefined;
|
|
105
|
+
p4_future_research_directions?: string | undefined;
|
|
106
|
+
cc_record_keeping_and_data_management?: string | undefined;
|
|
107
|
+
cc_collaboration_strategy?: string | undefined;
|
|
108
|
+
cc_ethical_considerations?: string | undefined;
|
|
109
|
+
include_detailed_prompts_for_agent?: boolean | undefined;
|
|
110
|
+
}>;
|
|
111
|
+
export type PubMedResearchAgentInput = z.infer<typeof PubMedResearchAgentInputSchema>;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Defines the Zod input schema and TypeScript types for the pubmed_research_agent tool.
|
|
3
|
+
* This schema accepts detailed components of a research plan from the client,
|
|
4
|
+
* which the tool will then structure into a standardized output format.
|
|
5
|
+
* @module pubmedResearchAgent/logic/inputSchema
|
|
6
|
+
*/
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
export const PubMedResearchAgentInputSchema = z.object({
|
|
9
|
+
// Overall Project Information
|
|
10
|
+
project_title_suggestion: z
|
|
11
|
+
.string()
|
|
12
|
+
.min(5)
|
|
13
|
+
.describe("A concise and descriptive title for the research project."),
|
|
14
|
+
primary_research_goal: z
|
|
15
|
+
.string()
|
|
16
|
+
.min(10)
|
|
17
|
+
.describe('The main scientific objective or central question the research aims to address (e.g., "To investigate the role of TREM2 in microglial response to amyloid-beta plaques").'),
|
|
18
|
+
research_keywords: z
|
|
19
|
+
.array(z.string().min(1))
|
|
20
|
+
.min(1)
|
|
21
|
+
.describe('Core scientific keywords or MeSH terms defining the research domain (e.g., ["neuroinflammation", "Alzheimer\'s disease", "TREM2"]).'),
|
|
22
|
+
organism_focus: z
|
|
23
|
+
.string()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe('Primary organism(s) or model systems (e.g., "Homo sapiens (iPSC-derived microglia)", "Mus musculus (5xFAD model)").'),
|
|
26
|
+
// Phase 1: Conception and Planning Inputs
|
|
27
|
+
p1_introduction_and_background: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Brief overview of the research area, its significance, and relevant background information leading to this study."),
|
|
31
|
+
p1_specific_research_question: z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe("The precise, focused primary research question the study will answer."),
|
|
35
|
+
p1_knowledge_gap: z
|
|
36
|
+
.string()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("Statement clearly identifying the specific gap in current knowledge this research addresses."),
|
|
39
|
+
p1_primary_hypothesis: z
|
|
40
|
+
.string()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("The main, testable hypothesis. Should be clear, specific, and falsifiable."),
|
|
43
|
+
p1_secondary_questions_or_hypotheses: z
|
|
44
|
+
.array(z.string())
|
|
45
|
+
.optional()
|
|
46
|
+
.describe("Any secondary questions or hypotheses to be explored."),
|
|
47
|
+
p1_pubmed_search_strategy_description: z
|
|
48
|
+
.string()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe("Description of the primary literature search strategy (e.g., for PubMed), including key terms and database considerations."),
|
|
51
|
+
p1_literature_review_scope: z
|
|
52
|
+
.string()
|
|
53
|
+
.optional()
|
|
54
|
+
.describe("The defined scope for the literature review (e.g., timeframes, study types, key themes)."),
|
|
55
|
+
p1_lit_review_databases_and_approach: z
|
|
56
|
+
.string()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe("Key databases (e.g., PubMed, EMBASE) and the search approach (e.g., iterative queries, snowballing)."),
|
|
59
|
+
p1_experimental_paradigm: z
|
|
60
|
+
.string()
|
|
61
|
+
.optional()
|
|
62
|
+
.describe("The overarching experimental design or study type (e.g., 'comparative multi-omics analysis', 'longitudinal cohort study')."),
|
|
63
|
+
p1_data_acquisition_plan_existing_data: z
|
|
64
|
+
.string()
|
|
65
|
+
.optional()
|
|
66
|
+
.describe("Strategy for identifying and retrieving relevant existing datasets (databases, data types, tools)."),
|
|
67
|
+
p1_data_acquisition_plan_new_data: z
|
|
68
|
+
.string()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Plan for generating novel data (data types, experimental models, key procedures, deposition plan)."),
|
|
71
|
+
p1_blast_utilization_plan: z
|
|
72
|
+
.string()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe("If applicable, how sequence alignment services (e.g., NCBI BLAST) will be used (purpose, programs, databases)."),
|
|
75
|
+
p1_controls_and_rigor: z
|
|
76
|
+
.string()
|
|
77
|
+
.optional()
|
|
78
|
+
.describe("Description of key experimental controls and measures to ensure scientific rigor and reproducibility."),
|
|
79
|
+
p1_methodological_challenges_and_mitigation: z
|
|
80
|
+
.string()
|
|
81
|
+
.optional()
|
|
82
|
+
.describe("Anticipated methodological challenges and proposed mitigation strategies."),
|
|
83
|
+
// Phase 2: Data Collection and Processing Inputs
|
|
84
|
+
p2_data_collection_methods_wet_lab: z
|
|
85
|
+
.string()
|
|
86
|
+
.optional()
|
|
87
|
+
.describe("Specific wet-lab protocols if new data is generated (sample prep, treatments, instruments)."),
|
|
88
|
+
p2_data_collection_methods_dry_lab: z
|
|
89
|
+
.string()
|
|
90
|
+
.optional()
|
|
91
|
+
.describe("Execution details for data retrieval from databases (queries, tools, accessioning)."),
|
|
92
|
+
p2_data_preprocessing_and_qc_plan: z
|
|
93
|
+
.string()
|
|
94
|
+
.optional()
|
|
95
|
+
.describe("Pipeline for data cleaning, preprocessing (e.g., alignment, normalization), and quality control (metrics, thresholds, tools)."),
|
|
96
|
+
// Phase 3: Analysis and Interpretation Inputs
|
|
97
|
+
p3_data_analysis_strategy: z
|
|
98
|
+
.string()
|
|
99
|
+
.optional()
|
|
100
|
+
.describe("Core statistical and computational methods to analyze data and test hypotheses (tests, software, ML models if any)."),
|
|
101
|
+
p3_bioinformatics_pipeline_summary: z
|
|
102
|
+
.string()
|
|
103
|
+
.optional()
|
|
104
|
+
.describe("Summary of the bioinformatics pipeline for high-throughput data analysis (tools, downstream analyses)."),
|
|
105
|
+
p3_results_interpretation_framework: z
|
|
106
|
+
.string()
|
|
107
|
+
.optional()
|
|
108
|
+
.describe("Framework for evaluating findings against hypotheses (statistical significance, biological relevance)."),
|
|
109
|
+
p3_comparison_with_literature_plan: z
|
|
110
|
+
.string()
|
|
111
|
+
.optional()
|
|
112
|
+
.describe("Strategy for contextualizing results with existing literature and addressing discrepancies."),
|
|
113
|
+
// Phase 4: Dissemination and Iteration Inputs
|
|
114
|
+
p4_dissemination_manuscript_plan: z
|
|
115
|
+
.string()
|
|
116
|
+
.optional()
|
|
117
|
+
.describe("Plan for manuscript preparation (core message, target journal profile, key figures)."),
|
|
118
|
+
p4_dissemination_data_deposition_plan: z
|
|
119
|
+
.string()
|
|
120
|
+
.optional()
|
|
121
|
+
.describe("Strategy for depositing data in public repositories (types, repositories, FAIR principles)."),
|
|
122
|
+
p4_peer_review_and_publication_approach: z
|
|
123
|
+
.string()
|
|
124
|
+
.optional()
|
|
125
|
+
.describe("Approach to journal submission and addressing peer review."),
|
|
126
|
+
p4_future_research_directions: z
|
|
127
|
+
.string()
|
|
128
|
+
.optional()
|
|
129
|
+
.describe("Potential next steps, new questions, or translational applications arising from the research."),
|
|
130
|
+
// Cross-Cutting Considerations Inputs
|
|
131
|
+
cc_record_keeping_and_data_management: z
|
|
132
|
+
.string()
|
|
133
|
+
.optional()
|
|
134
|
+
.describe("Plan for record-keeping, version control, data storage, and DMP."),
|
|
135
|
+
cc_collaboration_strategy: z
|
|
136
|
+
.string()
|
|
137
|
+
.optional()
|
|
138
|
+
.describe("If applicable, strategy for collaboration, communication, roles, and authorship."),
|
|
139
|
+
cc_ethical_considerations: z
|
|
140
|
+
.string()
|
|
141
|
+
.optional()
|
|
142
|
+
.describe("Ethical considerations, IRB/IACUC approval plans, data privacy, RCR training."),
|
|
143
|
+
// Meta-parameter from previous iterations, still useful
|
|
144
|
+
include_detailed_prompts_for_agent: z // Renamed from include_edge_cases_and_challenges_in_plan
|
|
145
|
+
.boolean()
|
|
146
|
+
.optional()
|
|
147
|
+
.default(false) // Default to false, meaning the tool primarily structures the detailed input.
|
|
148
|
+
.describe("If true, the tool will add more detailed instructive prompts/guidance within the output fields for a research agent. If false (default), it will primarily structure the provided inputs with minimal additional prompting."),
|
|
149
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Defines TypeScript types for the structured research plan outline
|
|
3
|
+
* generated by the pubmed_research_agent tool. The tool primarily structures
|
|
4
|
+
* client-provided inputs.
|
|
5
|
+
* @module pubmedResearchAgent/logic/outputTypes
|
|
6
|
+
*/
|
|
7
|
+
export interface Phase1Step1_1_Content {
|
|
8
|
+
primary_research_question?: string;
|
|
9
|
+
knowledge_gap_statement?: string;
|
|
10
|
+
primary_hypothesis?: string;
|
|
11
|
+
pubmed_search_strategy?: string;
|
|
12
|
+
guidance_notes?: string | string[];
|
|
13
|
+
}
|
|
14
|
+
export interface Phase1Step1_2_Content {
|
|
15
|
+
literature_review_scope?: string;
|
|
16
|
+
key_databases_and_search_approach?: string;
|
|
17
|
+
guidance_notes?: string | string[];
|
|
18
|
+
}
|
|
19
|
+
export interface Phase1Step1_3_Content {
|
|
20
|
+
experimental_paradigm?: string;
|
|
21
|
+
data_acquisition_plan_existing_data?: string;
|
|
22
|
+
data_acquisition_plan_new_data?: string;
|
|
23
|
+
blast_utilization_plan?: string;
|
|
24
|
+
controls_and_rigor_measures?: string;
|
|
25
|
+
methodological_challenges_and_mitigation?: string;
|
|
26
|
+
guidance_notes?: string | string[];
|
|
27
|
+
}
|
|
28
|
+
export interface Phase1Output {
|
|
29
|
+
title: "Phase 1: Conception and Planning";
|
|
30
|
+
step_1_1_research_question_and_hypothesis: Phase1Step1_1_Content;
|
|
31
|
+
step_1_2_literature_review_strategy: Phase1Step1_2_Content;
|
|
32
|
+
step_1_3_experimental_design_and_data_acquisition: Phase1Step1_3_Content;
|
|
33
|
+
}
|
|
34
|
+
export interface Phase2Step2_1_Content {
|
|
35
|
+
data_collection_methods_wet_lab?: string;
|
|
36
|
+
data_collection_methods_dry_lab?: string;
|
|
37
|
+
guidance_notes?: string | string[];
|
|
38
|
+
}
|
|
39
|
+
export interface Phase2Step2_2_Content {
|
|
40
|
+
data_preprocessing_and_qc_plan?: string;
|
|
41
|
+
guidance_notes?: string | string[];
|
|
42
|
+
}
|
|
43
|
+
export interface Phase2Output {
|
|
44
|
+
title: "Phase 2: Data Collection and Processing";
|
|
45
|
+
step_2_1_data_collection_retrieval: Phase2Step2_1_Content;
|
|
46
|
+
step_2_2_data_preprocessing_and_qc: Phase2Step2_2_Content;
|
|
47
|
+
}
|
|
48
|
+
export interface Phase3Step3_1_Content {
|
|
49
|
+
data_analysis_strategy?: string;
|
|
50
|
+
bioinformatics_pipeline_summary?: string;
|
|
51
|
+
guidance_notes?: string | string[];
|
|
52
|
+
}
|
|
53
|
+
export interface Phase3Step3_2_Content {
|
|
54
|
+
results_interpretation_framework?: string;
|
|
55
|
+
comparison_with_literature_plan?: string;
|
|
56
|
+
guidance_notes?: string | string[];
|
|
57
|
+
}
|
|
58
|
+
export interface Phase3Output {
|
|
59
|
+
title: "Phase 3: Analysis and Interpretation";
|
|
60
|
+
step_3_1_data_analysis_plan: Phase3Step3_1_Content;
|
|
61
|
+
step_3_2_results_interpretation: Phase3Step3_2_Content;
|
|
62
|
+
}
|
|
63
|
+
export interface Phase4Step4_1_Content {
|
|
64
|
+
dissemination_manuscript_plan?: string;
|
|
65
|
+
dissemination_data_deposition_plan?: string;
|
|
66
|
+
guidance_notes?: string | string[];
|
|
67
|
+
}
|
|
68
|
+
export interface Phase4Step4_2_Content {
|
|
69
|
+
peer_review_and_publication_approach?: string;
|
|
70
|
+
guidance_notes?: string | string[];
|
|
71
|
+
}
|
|
72
|
+
export interface Phase4Step4_3_Content {
|
|
73
|
+
future_research_directions?: string;
|
|
74
|
+
guidance_notes?: string | string[];
|
|
75
|
+
}
|
|
76
|
+
export interface Phase4Output {
|
|
77
|
+
title: "Phase 4: Dissemination and Iteration";
|
|
78
|
+
step_4_1_dissemination_strategy: Phase4Step4_1_Content;
|
|
79
|
+
step_4_2_peer_review_and_publication: Phase4Step4_2_Content;
|
|
80
|
+
step_4_3_further_research_and_iteration: Phase4Step4_3_Content;
|
|
81
|
+
}
|
|
82
|
+
export interface CrossCuttingContent {
|
|
83
|
+
record_keeping_and_data_management?: string;
|
|
84
|
+
collaboration_strategy?: string;
|
|
85
|
+
ethical_considerations?: string;
|
|
86
|
+
guidance_notes?: string | string[];
|
|
87
|
+
}
|
|
88
|
+
export interface CrossCuttingOutput {
|
|
89
|
+
title: "Cross-Cutting Considerations";
|
|
90
|
+
content: CrossCuttingContent;
|
|
91
|
+
}
|
|
92
|
+
export interface PubMedResearchPlanGeneratedOutput {
|
|
93
|
+
plan_title: string;
|
|
94
|
+
overall_instructions_for_research_agent?: string;
|
|
95
|
+
input_summary: {
|
|
96
|
+
keywords_received: string[];
|
|
97
|
+
primary_goal_stated_or_inferred: string;
|
|
98
|
+
organism_focus?: string;
|
|
99
|
+
included_detailed_prompts_for_agent: boolean;
|
|
100
|
+
};
|
|
101
|
+
phase_1_conception_and_planning: Phase1Output;
|
|
102
|
+
phase_2_data_collection_and_processing: Phase2Output;
|
|
103
|
+
phase_3_analysis_and_interpretation: Phase3Output;
|
|
104
|
+
phase_4_dissemination_and_iteration: Phase4Output;
|
|
105
|
+
cross_cutting_considerations: CrossCuttingOutput;
|
|
106
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Orchestrates the generation of the research plan outline
|
|
3
|
+
* by directly mapping detailed client inputs to a structured output format.
|
|
4
|
+
* Omits sections/steps if no relevant input is provided.
|
|
5
|
+
* @module pubmedResearchAgent/logic/planOrchestrator
|
|
6
|
+
*/
|
|
7
|
+
import { RequestContext } from "../../../../utils/index.js";
|
|
8
|
+
import type { PubMedResearchAgentInput } from "./inputSchema.js";
|
|
9
|
+
import type { PubMedResearchPlanGeneratedOutput } from "./outputTypes.js";
|
|
10
|
+
export declare function generateFullResearchPlanOutline(input: PubMedResearchAgentInput, parentRequestContext: RequestContext): PubMedResearchPlanGeneratedOutput;
|