get_target_details
Retrieve comprehensive gene target information including drug and disease associations for research analysis using Ensembl gene IDs.
Instructions
Get comprehensive target information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Target Ensembl gene ID |
Implementation Reference
- src/index.ts:566-600 (handler)The main handler function that implements the core logic of the 'get_target_details' tool. It validates the input using isValidIdArgs, performs a GraphQL query to the Open Targets API to retrieve target details (id, approvedName, approvedSymbol, biotype) based on the Ensembl gene ID, and returns the JSON response or an error message.private async handleGetTargetDetails(args: any) { if (!isValidIdArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Target ID is required'); } try { const query = `query GetTarget($ensemblId: String!) { target(ensemblId: $ensemblId) { id approvedName approvedSymbol biotype } }`; const response = await this.graphqlClient.post('', { query, variables: { ensemblId: args.id } }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error getting target details: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:266-272 (schema)The input schema definition for the 'get_target_details' tool, specifying that it requires a single 'id' property of type string representing the Target Ensembl gene ID.inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Target Ensembl gene ID' }, }, required: ['id'], },
- src/index.ts:263-273 (registration)The tool registration entry in the ListToolsRequestSchema handler, defining the tool's name, description, and input schema for MCP tool discovery.{ name: 'get_target_details', description: 'Get comprehensive target information', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Target Ensembl gene ID' }, }, required: ['id'], }, },
- src/index.ts:300-301 (registration)The dispatch case in the CallToolRequestSchema switch statement that routes calls to the 'get_target_details' tool to its handler function.case 'get_target_details': return this.handleGetTargetDetails(args);
- src/index.ts:50-57 (helper)Helper function used by the handler to validate that input arguments contain a non-empty string 'id' property, matching the tool's input schema.const isValidIdArgs = (args: any): args is { id: string } => { return ( typeof args === 'object' && args !== null && typeof args.id === 'string' && args.id.length > 0 ); };