BioContext7

TypeScript SDK

Use the BioContext7 TypeScript SDK for Node.js and browser integration

Installation

npm install @biocontext7/sdk

Quick Start

import { BioContext7Client } from "@biocontext7/sdk";
 
const client = new BioContext7Client({
  baseUrl: "http://localhost:3000",
});
 
// Search for tools
const results = await client.search("RNA-seq alignment");
for (const tool of results.tools) {
  console.log(`${tool.name}: ${tool.description}`);
}

API Reference

BioContext7Client

The main client class for interacting with the BioContext7 API.

import { BioContext7Client } from "@biocontext7/sdk";
 
const client = new BioContext7Client({
  baseUrl: "http://localhost:3000",
  apiKey: process.env.BC7_API_KEY, // optional
  timeout: 30000, // optional, in ms
});

client.search(query, options?)

Search the tool registry.

const results = await client.search("alignment", {
  operation: "operation:0292",
  topic: "topic:3308",
  limit: 10,
});
 
// results.tools: Tool[]
// results.total: number

client.getTool(toolId)

Get detailed tool information.

const tool = await client.getTool("star");
// tool.name, tool.description, tool.operations, tool.inputs, tool.outputs

client.suggestPipeline(task)

Get a suggested tool chain for a workflow.

const suggestion = await client.suggestPipeline(
  "RNA-seq differential expression"
);
// suggestion.steps: PipelineStep[]

client.createPipeline(intent, options?)

Generate a pipeline from natural language.

const pipeline = await client.createPipeline(
  "RNA-seq from FASTQ to counts",
  { target: "nextflow" }
);
 
if (pipeline.success) {
  console.log(pipeline.files["main.nf"]);
}

client.lookupEdam(term)

Convert natural language to EDAM ontology terms.

const edam = await client.lookupEdam("sequence alignment");
// edam.uri: string
// edam.term: string

Types

interface Tool {
  id: string;
  name: string;
  description: string;
  version?: string;
  operations: EdamTerm[];
  topics: EdamTerm[];
  inputs: DataType[];
  outputs: DataType[];
  homepage?: string;
  containers?: ContainerInfo;
}
 
interface EdamTerm {
  uri: string;
  term: string;
}
 
interface SearchResult {
  tools: Tool[];
  total: number;
  query: string;
}
 
interface PipelineResult {
  success: boolean;
  target: string;
  files: Record<string, string>;
  tools_discovered: number;
  lsp_iterations: number;
  stub_test_passed: boolean;
}

Vercel AI SDK Integration

BioContext7 provides a Vercel AI SDK tool integration:

import { biocontext7Tools } from "@biocontext7/tools-ai-sdk";
import { generateText } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
 
const result = await generateText({
  model: anthropic("claude-sonnet-4-5-20250929"),
  tools: biocontext7Tools(),
  prompt: "Find tools for protein structure prediction",
});

On this page