get_motif_features
Identify transcription factor binding motifs within a specified genomic region using species-specific data. Input genomic coordinates and optional binding matrix for targeted analysis.
Instructions
Get transcription factor binding motifs in genomic region
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| binding_matrix | No | Specific binding matrix (optional) | |
| region | Yes | Genomic region (chr:start-end) | |
| species | No | Species name (default: homo_sapiens) |
Implementation Reference
- src/index.ts:1418-1446 (handler)Main handler function implementing the tool: validates args, formats region, calls Ensembl REST API /regulatory/species/{species}/microarray/{region} endpoint, returns JSON response or error.private async handleGetMotifFeatures(args: any) { if (!isValidMotifArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid motif feature arguments'); } try { const species = this.getDefaultSpecies(args.species); const region = this.formatGenomicRegion(args.region); const params: any = {}; if (args.binding_matrix) { params.binding_matrix = args.binding_matrix; } const response = await this.apiClient.get(`/regulatory/species/${species}/microarray/${region}`, { params }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error) { return this.handleError(error, 'fetching motif features'); } }
- src/index.ts:725-736 (schema)Tool registration entry including name, description, and input schema definition for the ListToolsRequest response.name: 'get_motif_features', description: 'Get transcription factor binding motifs in genomic region', inputSchema: { type: 'object', properties: { region: { type: 'string', description: 'Genomic region (chr:start-end)' }, species: { type: 'string', description: 'Species name (default: homo_sapiens)' }, binding_matrix: { type: 'string', description: 'Specific binding matrix (optional)' }, }, required: ['region'], }, },
- src/index.ts:861-862 (registration)Dispatch case in CallToolRequestSchema handler that routes tool calls to the implementation.case 'get_motif_features': return this.handleGetMotifFeatures(args);
- src/index.ts:323-334 (helper)Type guard function for input validation used in the handler.const isValidMotifArgs = ( args: any ): args is { region: string; species?: string; binding_matrix?: string } => { return ( typeof args === 'object' && args !== null && typeof args.region === 'string' && args.region.length > 0 && (args.species === undefined || typeof args.species === 'string') && (args.binding_matrix === undefined || typeof args.binding_matrix === 'string') ); };