Skip to main content
Glama

search_by_tsn

Find detailed taxonomic information for organisms using Taxonomic Serial Numbers (TSN) within the ITIS database, facilitating accurate species identification and research.

Instructions

Search for organisms by their Taxonomic Serial Number (TSN) in ITIS database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tsnYesTaxonomic Serial Number (TSN) to search for

Implementation Reference

  • MCP tool handler for 'search_by_tsn': extracts TSN argument, calls ITISClient.searchByTSN, and returns formatted JSON response.
    case 'search_by_tsn': { const { tsn } = args as any; const result = await itisClient.searchByTSN(tsn); return { content: [ { type: 'text', text: JSON.stringify({ tsn, totalResults: result.response.numFound, results: result.response.docs, }, null, 2), }, ], }; }
  • Input schema definition for the 'search_by_tsn' tool, specifying required 'tsn' parameter.
    inputSchema: { type: 'object', properties: { tsn: { type: 'string', description: 'Taxonomic Serial Number (TSN) to search for', }, }, required: ['tsn'], },
  • src/tools.ts:69-82 (registration)
    Registration of the 'search_by_tsn' tool in the tools array, including name, description, and input schema.
    { name: 'search_by_tsn', description: 'Search for organisms by their Taxonomic Serial Number (TSN) in ITIS database.', inputSchema: { type: 'object', properties: { tsn: { type: 'string', description: 'Taxonomic Serial Number (TSN) to search for', }, }, required: ['tsn'], }, },
  • Core implementation of searchByTSN in ITISClient: performs SOLR query 'tsn:{tsn}' using the base search method.
    async searchByTSN(tsn: string, options: Partial<ITISSearchOptions> = {}): Promise<ITISResponse> { return this.search({ ...options, query: `tsn:${tsn}`, }); }
  • Base search helper method used by searchByTSN to query the ITIS SOLR API with constructed parameters.
    async search(options: ITISSearchOptions = {}): Promise<ITISResponse> { const params = new URLSearchParams(); // Default parameters params.append('wt', 'json'); params.append('indent', 'true'); // Query parameter if (options.query) { params.append('q', options.query); } else { params.append('q', '*:*'); } // Pagination if (options.start !== undefined) { params.append('start', options.start.toString()); } if (options.rows !== undefined) { params.append('rows', options.rows.toString()); } else { params.append('rows', '10'); // Default to 10 rows } // Sorting if (options.sort) { params.append('sort', options.sort); } // Field selection if (options.fields && options.fields.length > 0) { params.append('fl', options.fields.join(',')); } // Filters if (options.filters) { Object.entries(options.filters).forEach(([key, value]) => { params.append('fq', `${key}:${value}`); }); } const url = `${this.baseUrl}?${params.toString()}`; try { const response = await fetch(url); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json() as ITISResponse; return data; } catch (error) { throw new Error(`Failed to fetch ITIS data: ${error}`); } }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/knustx/itis-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server