get_class_info
Retrieve detailed information about a specific ontology class, including attributes like preferred labels, definitions, and hierarchical relationships, using the BioOntology MCP Server.
Instructions
Get detailed information about a specific ontology class
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| class_id | Yes | Class ID/URI (URL-encoded if necessary) | |
| include | No | Comma-separated attributes to include (e.g., prefLabel,definition,parents,children) | |
| ontology | Yes | Ontology acronym |
Implementation Reference
- src/index.ts:1042-1075 (handler)The main handler function that executes the get_class_info tool logic. Validates args, makes API call to BioOntology.org for class info, returns JSON response or error.private async handleGetClassInfo(args: any) { if (!isValidGetClassInfoArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Invalid class info arguments'); } try { const params: any = { apikey: this.apiKey, }; if (args.include) params.include = args.include; const response = await this.apiClient.get(`/ontologies/${args.ontology}/classes/${encodeURIComponent(args.class_id)}`, { params }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; } catch (error: any) { return { content: [ { type: 'text', text: `Error fetching class info: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], isError: true, }; } }
- src/index.ts:204-216 (schema)Type guard function for validating input arguments to get_class_info tool.const isValidGetClassInfoArgs = ( args: any ): args is { ontology: string; class_id: string; include?: string } => { return ( typeof args === 'object' && args !== null && typeof args.ontology === 'string' && args.ontology.length > 0 && typeof args.class_id === 'string' && args.class_id.length > 0 && (args.include === undefined || typeof args.include === 'string') ); };
- src/index.ts:656-667 (registration)Tool registration in the ListToolsRequestSchema handler, including name, description, and input schema definition.name: 'get_class_info', description: 'Get detailed information about a specific ontology class', inputSchema: { type: 'object', properties: { ontology: { type: 'string', description: 'Ontology acronym' }, class_id: { type: 'string', description: 'Class ID/URI (URL-encoded if necessary)' }, include: { type: 'string', description: 'Comma-separated attributes to include (e.g., prefLabel,definition,parents,children)' }, }, required: ['ontology', 'class_id'], }, },
- src/index.ts:717-718 (registration)Dispatch case in the CallToolRequestSchema switch statement that routes to the handler.case 'get_class_info': return this.handleGetClassInfo(args);