core-llm-tools
@equationalapplications/core-llm-tools · npm · source
Shared, strictly typed tool schemas for Gemini function calling, kept separate from the code that runs the tools. Edge models (in the browser or on device) and cloud agents can use the same schemas. A scope model similar to OAuth means a model only sees tools the user granted.
It’s standalone: there’s no SQLite or framework dependency, and it runs on Node, browsers, and Hermes.
npm install @equationalapplications/core-llm-toolsDefine a tool
Section titled “Define a tool”import type { AgentToolManifest } from '@equationalapplications/core-llm-tools';
export const getCalendarEventsManifest: AgentToolManifest = { name: 'get_calendar_events', scope: 'calendar:read', schema: { name: 'get_calendar_events', description: "Fetch the user's schedule for a given date.", parameters: { type: 'object', properties: { date: { type: 'string' } } }, },};Inject only authorized tools
Section titled “Inject only authorized tools”import { buildAuthorizedToolsArray, escalateToCloudManifest, googleSearchManifest } from '@equationalapplications/core-llm-tools';
const tools = buildAuthorizedToolsArray( [escalateToCloudManifest, getCalendarEventsManifest, googleSearchManifest], ['calendar:read'], // the user's granted scopes);// → [{ functionDeclarations: [escalate_to_cloud_agent, get_calendar_events] }, { googleSearch: {} }]// (escalate_to_cloud_agent and google_search are in the always-on 'core' scope;// the manifest is named google_search, and the key Gemini reads is googleSearch)
await ai.models.generateContent({ model: 'gemini-flash-latest', contents, config: { tools } });- Tools in the
corescope are always included. - All authorized function tools are collapsed into one
functionDeclarationsgroup. - Built-in tools (
kind: 'built_in', such as Google Search) each add their own entry. Use theAnyAgentToolManifesttype when you mix both kinds.
Built-in manifests
Section titled “Built-in manifests”| Manifest | Tool name | Scope |
|---|---|---|
escalateToCloudManifest |
escalate_to_cloud_agent |
core |
getCurrentTimeManifest |
get_current_time |
core |
googleSearchManifest |
google_search (built-in) |
core |
graphTraverseManifest |
graph_traverse |
memory:read |
ontologyGetManifest |
ontology_get |
memory:read |
instructionsGetManifest |
instructions_get |
memory:read |
The memory manifests are schema-only. Dispatch them to traverseGraph,
getOntologyManifest, and getInstructions. See the
Gemini agent recipe.