npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@equationalapplications/core-llm-tools

v6.2.0

Published

Zero-dependency Gemini function-calling schemas and capability-scoped tool injection for edge AI agents. Works in Node.js, browser, and React Native (Hermes).

Readme

@equationalapplications/core-llm-tools

Zero-dependency Gemini function-calling schemas and capability-scoped tool injection for edge AI agents. Works in Node.js, browser, and React Native (Hermes).

npm version npm downloads TypeScript License: MIT

GitHub · ScopeLab · WikiDemo · Changelog · Issues

A universal registry bridging the gap between Edge AI (Expo/React Native) and Cloud Agents (Cloud Run).

Overview

core-llm-tools provides a shared, strictly-typed repository of JSON Function Declarations (Tools) for Gemini models. By decoupling the Tool Interface (the schema) from the Tool Implementation (the executing code), this package allows client-side triage agents and heavy backend cloud agents to share the exact same capabilities without importing Node.js server dependencies into the browser or mobile environments.

It also introduces a robust Capability-Based Scope Model (similar to OAuth 2.0), ensuring that Large Language Models are only injected with tools the user has explicitly authorized.

Features

  • Platform-Agnostic — Zero runtime dependencies. Pure TypeScript. Compiles safely for Node.js, the browser, and the React Native Hermes engine.
  • Capability-Based Security — Tools are locked behind specific scopes (e.g., calendar:read, messages:send). The injector ensures models cannot hallucinate calls to unauthorized tools.
  • Strict Typings — Provides rigid interfaces (AgentToolSchema, AgentToolManifest) to prevent malformed Gemini API requests.
  • Harmonized Edge/Cloud Routing — Enables lightweight edge models (like Gemini Nano) to triage intents using the exact same schemas the heavy Cloud Run backend uses to execute them.
  • GraphRAG tool schemaswikiTraverseGraphManifest and wikiGetOntologyManifest are pre-built Gemini tool schemas for the GraphRAG retrieval API; see root README: GraphRAG.

Installation

npm install @equationalapplications/core-llm-tools
# or
pnpm add @equationalapplications/core-llm-tools

Quick Start

1. Defining a Tool Manifest

Tools are defined by wrapping a standard Gemini JSON schema with a required security scope.

import type { AgentToolManifest } from '@equationalapplications/core-llm-tools';

export const getCalendarEventsManifest: AgentToolManifest = {
  name: 'get_calendar_events',
  scope: 'calendar:read', // Security scope required to use this tool
  schema: {
    name: 'get_calendar_events',
    description: 'Fetch the user\'s schedule for a given date.',
    parameters: {
      type: 'object',
      properties: {
        date: { type: 'string' }
      }
    }
  }
};

2. Injecting Authorized Tools

At runtime, use buildAuthorizedSchemaArray to filter your tool library against the user's granted permissions before passing them to the LLM.

import { buildAuthorizedSchemaArray, escalateToCloudManifest } from '@equationalapplications/core-llm-tools';

// 1. Gather all manifests known to your app
const allAppTools = [escalateToCloudManifest, getCalendarEventsManifest];

// 2. Fetch the user's authorized scopes from your DB (e.g., SQLite/Postgres)
const userGrantedScopes = ['calendar:read'];

// 3. The injector automatically includes 'core' tools and authorized scoped tools
const schemasForLlm = buildAuthorizedSchemaArray(allAppTools, userGrantedScopes);

// 4. Pass safely to Gemini
const response = await ai.models.generateContent({
  model: 'gemini-2.5-flash',
  contents: userInput,
  tools: [{ functionDeclarations: schemasForLlm }],
});

3. Built-In Tools (Grounding)

Some Gemini capabilities, like Google Search grounding, are built-in tools executed server-side by Google rather than function declarations your code implements. These are declared with kind: 'built_in' and flow through the same capability-scope model as function tools, via buildAuthorizedToolsArray. Use AnyAgentToolManifest when mixing function and built-in manifests; AgentToolManifest remains the function-only type for existing callers:

import type { AnyAgentToolManifest } from '@equationalapplications/core-llm-tools';
import { buildAuthorizedToolsArray, googleSearchManifest, escalateToCloudManifest } from '@equationalapplications/core-llm-tools';

const allAppTools: AnyAgentToolManifest[] = [escalateToCloudManifest, googleSearchManifest];
const userGrantedScopes: string[] = [];

// Returns the full Gemini tools[] array: a functionDeclarations group (if any
// function tools are authorized) plus one entry per authorized built-in tool.
const tools = buildAuthorizedToolsArray(allAppTools, userGrantedScopes);
// => [{ functionDeclarations: [...] }, { google_search: {} }]

const response = await ai.models.generateContent({
  model: 'gemini-2.5-flash',
  contents: userInput,
  tools,
});

Note: When the model uses google_search, Gemini returns a groundingMetadata object (search queries, source citations, etc.) on the response. Parsing that metadata is the caller's responsibility — this package only handles the request-side tool declaration.

buildAuthorizedSchemaArray is still available for callers that only ever use function tools, but is deprecated in favor of buildAuthorizedToolsArray.

Helpful Resources & Links

Monorepo Ecosystem

| Package | Purpose | | ----- | ----- | | @equationalapplications/core-llm-wiki | Persistent episodic memory | | @equationalapplications/expo-llm-wiki | Persistent episodic memory for Expo/React Native | | @equationalapplications/react-llm-wiki | Persistent episodic memory for Web | | @equationalapplications/prisma-outbox | Sync SQLite outbox events to Prisma | | @equationalapplications/core-llm-tools | Gemini tool schemas and capability injector | | @equationalapplications/core-okf | Zero-dependency Open Knowledge Format (OKF) v0.1 + v0.2 primitives — parse and produce interoperable knowledge bundles. | | @equationalapplications/schema-org-llm-wiki | Curated schema.org warm-agent ontology manifest | | @equationalapplications/schema-software-org | Software-organization executive ontology manifest — 17 node types, 40 edges, warm-agent superset, data-only |


Made with ❤️ by Equational Applications LLC. https://equationalapplications.com/