Skip to main content
Glama

batch_annotate

Annotate multiple texts with biological ontology terms in a single operation, identifying relevant concepts from over 1,200 ontologies for efficient batch processing.

Instructions

Process multiple texts for annotation efficiently

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textsYesArray of texts to annotate (max 10)
ontologiesNoComma-separated ontology acronyms
longest_onlyNoReturn only longest matches (default: true)
whole_word_onlyNoMatch whole words only (default: true)

Implementation Reference

  • The handler function that executes the batch_annotate tool. It validates input, loops through up to 10 texts, calls the BioOntology /annotator API for each with shared parameters, collects results or errors, and returns a JSON summary.
    private async handleBatchAnnotate(args: any) {
      if (!Array.isArray(args.texts) || args.texts.length === 0 || args.texts.length > 10) {
        throw new McpError(ErrorCode.InvalidParams, 'Invalid batch annotate arguments - texts must be array of 1-10 items');
      }
    
      try {
        const results = [];
    
        for (const text of args.texts) {
          const params: any = {
            text: text,
            apikey: this.apiKey,
          };
    
          if (args.ontologies) params.ontologies = args.ontologies;
          if (args.longest_only !== undefined) params.longest_only = args.longest_only;
          if (args.whole_word_only !== undefined) params.whole_word_only = args.whole_word_only;
    
          try {
            const response = await this.apiClient.get('/annotator', { params });
            results.push({ text, annotations: response.data, success: true });
          } catch (error: any) {
            results.push({ text, error: error.message, success: false });
          }
        }
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ batch_results: results }, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Error in batch annotation: ${error instanceof Error ? error.message : 'Unknown error'}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema definition for the batch_annotate tool, defining parameters like texts array (1-10 items), optional ontologies, longest_only, and whole_word_only.
    name: 'batch_annotate',
    description: 'Process multiple texts for annotation efficiently',
    inputSchema: {
      type: 'object',
      properties: {
        texts: { type: 'array', items: { type: 'string' }, description: 'Array of texts to annotate (max 10)', minItems: 1, maxItems: 10 },
        ontologies: { type: 'string', description: 'Comma-separated ontology acronyms' },
        longest_only: { type: 'boolean', description: 'Return only longest matches (default: true)' },
        whole_word_only: { type: 'boolean', description: 'Match whole words only (default: true)' },
      },
      required: ['texts'],
    },
  • src/index.ts:714-715 (registration)
    Registration of the batch_annotate tool in the CallToolRequestSchema switch dispatcher, routing calls to the handleBatchAnnotate method.
    case 'batch_annotate':
      return this.handleBatchAnnotate(args);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral information. It mentions 'efficiently' but doesn't disclose performance characteristics, rate limits, authentication requirements, error handling, or what happens when texts exceed the 10-item limit. For a batch processing tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function. Every word earns its place with no redundancy or unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a batch processing tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It doesn't explain what annotation means in this context, what the output looks like, error conditions, or performance expectations. The agent would need to guess about the tool's behavior and results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional parameter semantics beyond what's already in the schema (e.g., doesn't explain what 'ontologies' are, what 'annotation' entails, or provide examples). Baseline 3 is appropriate when schema does all the work.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('process multiple texts') and purpose ('for annotation efficiently'), distinguishing it from single-text annotation tools like 'annotate_text'. However, it doesn't specify what type of annotation (e.g., entity recognition, classification) or what 'efficiently' means operationally.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus the sibling 'annotate_text' tool. The description mentions 'efficiently' but doesn't explain what makes batch processing more efficient or under what conditions batch processing is preferred over single-text annotation.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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