get_target_details
Retrieve detailed gene target information, including gene-drug-disease associations, using Ensembl gene ID, for research and analysis on the Open Targets platform.
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-599 (handler)The main handler function that validates the input arguments and fetches comprehensive target details using a GraphQL query to the Open Targets API.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)Input schema defining the required 'id' parameter for the tool.inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'Target Ensembl gene ID' }, }, required: ['id'], },
- src/index.ts:263-273 (registration)Tool registration in the list returned by ListToolsRequestSchema, including name, description, and schema.{ 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)Dispatch to the handler in the CallToolRequestSchema switch statement.case 'get_target_details': return this.handleGetTargetDetails(args);
- src/index.ts:50-56 (helper)Type guard function used to validate the input arguments for ID-based tools, including get_target_details.const isValidIdArgs = (args: any): args is { id: string } => { return ( typeof args === 'object' && args !== null && typeof args.id === 'string' && args.id.length > 0 );