Skip to main content
Glama

get_class_info

Retrieve detailed information about biological ontology classes, including definitions, relationships, and attributes, to support ontology exploration and analysis.

Instructions

Get detailed information about a specific ontology class

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ontologyYesOntology acronym
class_idYesClass ID/URI (URL-encoded if necessary)
includeNoComma-separated attributes to include (e.g., prefLabel,definition,parents,children)

Implementation Reference

  • The handler function for the 'get_class_info' tool. Validates arguments, makes an API request to BioOntology.org for the specified ontology class, and returns the 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,
        };
      }
    }
  • Type guard function that validates the input arguments for the get_class_info tool, ensuring ontology and class_id are non-empty strings, and include is optional string.
    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:655-667 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the name, description, and detailed inputSchema for get_class_info.
    {
      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 calls to the get_class_info handler.
    case 'get_class_info':
      return this.handleGetClassInfo(args);

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/Augmented-Nature/BioOntology-MCP-Server'

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