get_paper
Retrieve scientific paper details including authors, abstract, and associated genes using WormBase or PubMed identifiers.
Instructions
Get information about a scientific paper/publication including authors, abstract, and associated genes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Paper identifier - WormBase paper ID (e.g., 'WBPaper00000001') or PubMed ID |
Implementation Reference
- src/index.ts:276-288 (handler)The handler function for the 'get_paper' tool. It invokes WormBaseClient.getEntity with type 'paper' and specific widgets ['overview', 'referenced_genes'], formats the result as JSON text, and handles errors.async ({ id }) => { try { const data = await client.getEntity("paper", id, ["overview", "referenced_genes"]); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error fetching paper: ${error}` }], isError: true, }; } }
- src/index.ts:273-275 (schema)Zod schema defining the input parameters for the 'get_paper' tool: a required string 'id' for the paper identifier.{ id: z.string().describe("Paper identifier - WormBase paper ID (e.g., 'WBPaper00000001') or PubMed ID"), },
- src/index.ts:270-289 (registration)MCP tool registration for 'get_paper' using McpServer.tool(), specifying name, description, input schema, and handler.server.tool( "get_paper", "Get information about a scientific paper/publication including authors, abstract, and associated genes.", { id: z.string().describe("Paper identifier - WormBase paper ID (e.g., 'WBPaper00000001') or PubMed ID"), }, async ({ id }) => { try { const data = await client.getEntity("paper", id, ["overview", "referenced_genes"]); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }], }; } catch (error) { return { content: [{ type: "text", text: `Error fetching paper: ${error}` }], isError: true, }; } } );
- src/client.ts:111-132 (helper)WormBaseClient.getEntity method: generic implementation to fetch data for any WormBase entity type (including 'paper') by querying REST API widgets and cleaning the response.async getEntity( type: EntityType, id: string, widgets?: string[] ): Promise<Record<string, unknown>> { const defaultWidgets = ["overview"]; const requestedWidgets = widgets || defaultWidgets; const result: Record<string, unknown> = { id, type }; for (const widget of requestedWidgets) { try { const url = `${this.baseUrl}/rest/widget/${type}/${encodeURIComponent(id)}/${widget}`; const data = await this.fetch<any>(url); result[widget] = this.cleanWidgetData(data); } catch (error) { result[widget] = { error: `Failed to fetch ${widget}` }; } } return result; }