@equationalapplications/core-llm-tools 4.11.0 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/dist/index.d.mts +36 -2
- package/dist/index.d.ts +36 -2
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,6 +81,41 @@ const response = await ai.models.generateContent({
|
|
|
81
81
|
});
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
### 3. Built-In Tools (Grounding)
|
|
85
|
+
|
|
86
|
+
Some Gemini capabilities, like [Google Search grounding](https://ai.google.dev/gemini-api/docs/google-search),
|
|
87
|
+
are built-in tools executed server-side by Google rather than function declarations your code
|
|
88
|
+
implements. These are declared with `kind: 'built_in'` and flow through the same
|
|
89
|
+
capability-scope model as function tools, via `buildAuthorizedToolsArray`.
|
|
90
|
+
Use `AnyAgentToolManifest` when mixing function and built-in manifests;
|
|
91
|
+
`AgentToolManifest` remains the function-only type for existing callers:
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
import type { AnyAgentToolManifest } from '@equationalapplications/core-llm-tools';
|
|
95
|
+
import { buildAuthorizedToolsArray, googleSearchManifest, escalateToCloudManifest } from '@equationalapplications/core-llm-tools';
|
|
96
|
+
|
|
97
|
+
const allAppTools: AnyAgentToolManifest[] = [escalateToCloudManifest, googleSearchManifest];
|
|
98
|
+
const userGrantedScopes: string[] = [];
|
|
99
|
+
|
|
100
|
+
// Returns the full Gemini tools[] array: a functionDeclarations group (if any
|
|
101
|
+
// function tools are authorized) plus one entry per authorized built-in tool.
|
|
102
|
+
const tools = buildAuthorizedToolsArray(allAppTools, userGrantedScopes);
|
|
103
|
+
// => [{ functionDeclarations: [...] }, { google_search: {} }]
|
|
104
|
+
|
|
105
|
+
const response = await ai.models.generateContent({
|
|
106
|
+
model: 'gemini-2.5-flash',
|
|
107
|
+
contents: userInput,
|
|
108
|
+
tools,
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
> **Note:** When the model uses `google_search`, Gemini returns a `groundingMetadata` object
|
|
113
|
+
> (search queries, source citations, etc.) on the response. Parsing that metadata is the
|
|
114
|
+
> caller's responsibility — this package only handles the request-side tool declaration.
|
|
115
|
+
|
|
116
|
+
`buildAuthorizedSchemaArray` is still available for callers that only ever use function tools,
|
|
117
|
+
but is deprecated in favor of `buildAuthorizedToolsArray`.
|
|
118
|
+
|
|
84
119
|
## Helpful Resources & Links
|
|
85
120
|
|
|
86
121
|
- [Google Gen AI: Function Calling Tutorial](https://ai.google.dev/gemini-api/docs/function-calling) — Official docs on how the JSON schemas in this package interact with Gemini models.
|
package/dist/index.d.mts
CHANGED
|
@@ -8,15 +8,49 @@ interface AgentToolSchema {
|
|
|
8
8
|
required?: string[];
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
/** Names of Gemini built-in tools (executed server-side, no client handler). */
|
|
12
|
+
type BuiltInToolName = 'google_search';
|
|
13
|
+
/** A tool backed by a client-implemented function-calling schema. */
|
|
14
|
+
interface FunctionToolManifest {
|
|
12
15
|
name: string;
|
|
13
16
|
scope: AgentScope;
|
|
17
|
+
/** Optional for backward compatibility — manifests without this field are function tools. */
|
|
18
|
+
kind?: 'function';
|
|
14
19
|
schema: AgentToolSchema;
|
|
15
20
|
}
|
|
21
|
+
/** A Gemini built-in tool (e.g. google_search) — no client handler, no parameters. */
|
|
22
|
+
interface BuiltInToolManifest {
|
|
23
|
+
name: BuiltInToolName;
|
|
24
|
+
scope: AgentScope;
|
|
25
|
+
kind: 'built_in';
|
|
26
|
+
builtIn: BuiltInToolName;
|
|
27
|
+
}
|
|
28
|
+
/** Function-calling tool manifest (stable public contract for downstream callers). */
|
|
29
|
+
type AgentToolManifest = FunctionToolManifest;
|
|
30
|
+
/** Union of function and built-in manifests for mixed tool arrays. */
|
|
31
|
+
type AnyAgentToolManifest = FunctionToolManifest | BuiltInToolManifest;
|
|
16
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use buildAuthorizedToolsArray instead — it returns the full Gemini
|
|
35
|
+
* tools[] array, including built-in tools like google_search. This function only
|
|
36
|
+
* ever returns function-declaration schemas; built-in manifests are ignored.
|
|
37
|
+
*/
|
|
17
38
|
declare function buildAuthorizedSchemaArray(availableManifests: AgentToolManifest[], userGrantedScopes: string[]): AgentToolSchema[];
|
|
39
|
+
/** One entry of a Gemini `tools[]` array: a function-declarations group, or a built-in tool. */
|
|
40
|
+
type GeminiToolEntry = {
|
|
41
|
+
functionDeclarations: AgentToolSchema[];
|
|
42
|
+
} | {
|
|
43
|
+
[K in BuiltInToolName]: Record<string, never>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Filters manifests by granted scope (core-scoped manifests always pass) and
|
|
47
|
+
* returns the full Gemini tools[] array: at most one functionDeclarations
|
|
48
|
+
* group, plus one entry per authorized built-in tool.
|
|
49
|
+
*/
|
|
50
|
+
declare function buildAuthorizedToolsArray(availableManifests: AnyAgentToolManifest[], userGrantedScopes: string[]): GeminiToolEntry[];
|
|
18
51
|
|
|
19
52
|
declare const getCurrentTimeManifest: AgentToolManifest;
|
|
20
53
|
declare const escalateToCloudManifest: AgentToolManifest;
|
|
54
|
+
declare const googleSearchManifest: BuiltInToolManifest;
|
|
21
55
|
|
|
22
|
-
export { type AgentScope, type AgentToolManifest, type AgentToolSchema, buildAuthorizedSchemaArray, escalateToCloudManifest, getCurrentTimeManifest };
|
|
56
|
+
export { type AgentScope, type AgentToolManifest, type AgentToolSchema, type AnyAgentToolManifest, type BuiltInToolManifest, type BuiltInToolName, type FunctionToolManifest, type GeminiToolEntry, buildAuthorizedSchemaArray, buildAuthorizedToolsArray, escalateToCloudManifest, getCurrentTimeManifest, googleSearchManifest };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,15 +8,49 @@ interface AgentToolSchema {
|
|
|
8
8
|
required?: string[];
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
/** Names of Gemini built-in tools (executed server-side, no client handler). */
|
|
12
|
+
type BuiltInToolName = 'google_search';
|
|
13
|
+
/** A tool backed by a client-implemented function-calling schema. */
|
|
14
|
+
interface FunctionToolManifest {
|
|
12
15
|
name: string;
|
|
13
16
|
scope: AgentScope;
|
|
17
|
+
/** Optional for backward compatibility — manifests without this field are function tools. */
|
|
18
|
+
kind?: 'function';
|
|
14
19
|
schema: AgentToolSchema;
|
|
15
20
|
}
|
|
21
|
+
/** A Gemini built-in tool (e.g. google_search) — no client handler, no parameters. */
|
|
22
|
+
interface BuiltInToolManifest {
|
|
23
|
+
name: BuiltInToolName;
|
|
24
|
+
scope: AgentScope;
|
|
25
|
+
kind: 'built_in';
|
|
26
|
+
builtIn: BuiltInToolName;
|
|
27
|
+
}
|
|
28
|
+
/** Function-calling tool manifest (stable public contract for downstream callers). */
|
|
29
|
+
type AgentToolManifest = FunctionToolManifest;
|
|
30
|
+
/** Union of function and built-in manifests for mixed tool arrays. */
|
|
31
|
+
type AnyAgentToolManifest = FunctionToolManifest | BuiltInToolManifest;
|
|
16
32
|
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Use buildAuthorizedToolsArray instead — it returns the full Gemini
|
|
35
|
+
* tools[] array, including built-in tools like google_search. This function only
|
|
36
|
+
* ever returns function-declaration schemas; built-in manifests are ignored.
|
|
37
|
+
*/
|
|
17
38
|
declare function buildAuthorizedSchemaArray(availableManifests: AgentToolManifest[], userGrantedScopes: string[]): AgentToolSchema[];
|
|
39
|
+
/** One entry of a Gemini `tools[]` array: a function-declarations group, or a built-in tool. */
|
|
40
|
+
type GeminiToolEntry = {
|
|
41
|
+
functionDeclarations: AgentToolSchema[];
|
|
42
|
+
} | {
|
|
43
|
+
[K in BuiltInToolName]: Record<string, never>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Filters manifests by granted scope (core-scoped manifests always pass) and
|
|
47
|
+
* returns the full Gemini tools[] array: at most one functionDeclarations
|
|
48
|
+
* group, plus one entry per authorized built-in tool.
|
|
49
|
+
*/
|
|
50
|
+
declare function buildAuthorizedToolsArray(availableManifests: AnyAgentToolManifest[], userGrantedScopes: string[]): GeminiToolEntry[];
|
|
18
51
|
|
|
19
52
|
declare const getCurrentTimeManifest: AgentToolManifest;
|
|
20
53
|
declare const escalateToCloudManifest: AgentToolManifest;
|
|
54
|
+
declare const googleSearchManifest: BuiltInToolManifest;
|
|
21
55
|
|
|
22
|
-
export { type AgentScope, type AgentToolManifest, type AgentToolSchema, buildAuthorizedSchemaArray, escalateToCloudManifest, getCurrentTimeManifest };
|
|
56
|
+
export { type AgentScope, type AgentToolManifest, type AgentToolSchema, type AnyAgentToolManifest, type BuiltInToolManifest, type BuiltInToolName, type FunctionToolManifest, type GeminiToolEntry, buildAuthorizedSchemaArray, buildAuthorizedToolsArray, escalateToCloudManifest, getCurrentTimeManifest, googleSearchManifest };
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,26 @@
|
|
|
4
4
|
function buildAuthorizedSchemaArray(availableManifests, userGrantedScopes) {
|
|
5
5
|
return availableManifests.filter(
|
|
6
6
|
(manifest) => manifest.scope === "core" || userGrantedScopes.includes(manifest.scope)
|
|
7
|
+
).filter(
|
|
8
|
+
(manifest) => "schema" in manifest
|
|
7
9
|
).map((manifest) => manifest.schema);
|
|
8
10
|
}
|
|
11
|
+
function buildAuthorizedToolsArray(availableManifests, userGrantedScopes) {
|
|
12
|
+
const authorized = availableManifests.filter(
|
|
13
|
+
(manifest) => manifest.scope === "core" || userGrantedScopes.includes(manifest.scope)
|
|
14
|
+
);
|
|
15
|
+
const entries = [];
|
|
16
|
+
const fnSchemas = authorized.filter(
|
|
17
|
+
(manifest) => manifest.kind !== "built_in"
|
|
18
|
+
).map((manifest) => manifest.schema);
|
|
19
|
+
if (fnSchemas.length > 0) entries.push({ functionDeclarations: fnSchemas });
|
|
20
|
+
for (const manifest of authorized) {
|
|
21
|
+
if (manifest.kind === "built_in") {
|
|
22
|
+
entries.push({ [manifest.builtIn]: {} });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return entries;
|
|
26
|
+
}
|
|
9
27
|
|
|
10
28
|
// src/manifests/core.ts
|
|
11
29
|
var getCurrentTimeManifest = {
|
|
@@ -26,9 +44,17 @@ var escalateToCloudManifest = {
|
|
|
26
44
|
parameters: { type: "object", properties: {} }
|
|
27
45
|
}
|
|
28
46
|
};
|
|
47
|
+
var googleSearchManifest = {
|
|
48
|
+
name: "google_search",
|
|
49
|
+
scope: "core",
|
|
50
|
+
kind: "built_in",
|
|
51
|
+
builtIn: "google_search"
|
|
52
|
+
};
|
|
29
53
|
|
|
30
54
|
exports.buildAuthorizedSchemaArray = buildAuthorizedSchemaArray;
|
|
55
|
+
exports.buildAuthorizedToolsArray = buildAuthorizedToolsArray;
|
|
31
56
|
exports.escalateToCloudManifest = escalateToCloudManifest;
|
|
32
57
|
exports.getCurrentTimeManifest = getCurrentTimeManifest;
|
|
58
|
+
exports.googleSearchManifest = googleSearchManifest;
|
|
33
59
|
//# sourceMappingURL=index.js.map
|
|
34
60
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/injector.ts","../src/manifests/core.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/injector.ts","../src/manifests/core.ts"],"names":[],"mappings":";;;AAaO,SAAS,0BAAA,CACd,oBACA,iBAAA,EACmB;AACnB,EAAA,OAAO,kBAAA,CACJ,MAAA;AAAA,IACC,CAAC,aACC,QAAA,CAAS,KAAA,KAAU,UAAU,iBAAA,CAAkB,QAAA,CAAS,SAAS,KAAK;AAAA,GAC1E,CACC,MAAA;AAAA,IACC,CAAC,aAA+C,QAAA,IAAY;AAAA,GAC9D,CACC,GAAA,CAAI,CAAC,QAAA,KAAa,SAAS,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;AAEO,IAAM,oBAAA,GAA4C;AAAA,EACvD,IAAA,EAAM,eAAA;AAAA,EACN,KAAA,EAAO,MAAA;AAAA,EACP,IAAA,EAAM,UAAA;AAAA,EACN,OAAA,EAAS;AACX","file":"index.js","sourcesContent":["import type {\n AgentToolManifest,\n AgentToolSchema,\n AnyAgentToolManifest,\n BuiltInToolName,\n FunctionToolManifest,\n} from './types';\n\n/**\n * @deprecated Use buildAuthorizedToolsArray instead — it returns the full Gemini\n * tools[] array, including built-in tools like google_search. This function only\n * ever returns function-declaration schemas; built-in manifests are ignored.\n */\nexport function buildAuthorizedSchemaArray(\n availableManifests: AgentToolManifest[],\n userGrantedScopes: string[]\n): AgentToolSchema[] {\n return availableManifests\n .filter(\n (manifest) =>\n manifest.scope === 'core' || userGrantedScopes.includes(manifest.scope)\n )\n .filter(\n (manifest): manifest is FunctionToolManifest => 'schema' in manifest\n )\n .map((manifest) => manifest.schema);\n}\n\n/** One entry of a Gemini `tools[]` array: a function-declarations group, or a built-in tool. */\nexport type GeminiToolEntry =\n | { functionDeclarations: AgentToolSchema[] }\n | { [K in BuiltInToolName]: Record<string, never> };\n\n/**\n * Filters manifests by granted scope (core-scoped manifests always pass) and\n * returns the full Gemini tools[] array: at most one functionDeclarations\n * group, plus one entry per authorized built-in tool.\n */\nexport function buildAuthorizedToolsArray(\n availableManifests: AnyAgentToolManifest[],\n userGrantedScopes: string[]\n): GeminiToolEntry[] {\n const authorized = availableManifests.filter(\n (manifest) =>\n manifest.scope === 'core' || userGrantedScopes.includes(manifest.scope)\n );\n\n const entries: GeminiToolEntry[] = [];\n\n const fnSchemas = authorized\n .filter(\n (manifest): manifest is FunctionToolManifest => manifest.kind !== 'built_in'\n )\n .map((manifest) => manifest.schema);\n if (fnSchemas.length > 0) entries.push({ functionDeclarations: fnSchemas });\n\n for (const manifest of authorized) {\n if (manifest.kind === 'built_in') {\n entries.push({ [manifest.builtIn]: {} } as GeminiToolEntry);\n }\n }\n\n return entries;\n}\n","import type { AgentToolManifest, BuiltInToolManifest } from '../types';\n\nexport const getCurrentTimeManifest: AgentToolManifest = {\n name: 'get_current_time',\n scope: 'core',\n schema: {\n name: 'get_current_time',\n description:\n 'Get the exact current date and time. Always call this tool first if resolving relative temporal words like \"today\" or \"tomorrow\".',\n parameters: { type: 'object', properties: {} },\n },\n};\n\nexport const escalateToCloudManifest: AgentToolManifest = {\n name: 'escalate_to_cloud_agent',\n scope: 'core',\n schema: {\n name: 'escalate_to_cloud_agent',\n description:\n 'Use this tool when the user asks to schedule a reminder, perform deep memory searches, or execute a complex workflow that requires cloud resources.',\n parameters: { type: 'object', properties: {} },\n },\n};\n\nexport const googleSearchManifest: BuiltInToolManifest = {\n name: 'google_search',\n scope: 'core',\n kind: 'built_in',\n builtIn: 'google_search',\n};\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,26 @@
|
|
|
2
2
|
function buildAuthorizedSchemaArray(availableManifests, userGrantedScopes) {
|
|
3
3
|
return availableManifests.filter(
|
|
4
4
|
(manifest) => manifest.scope === "core" || userGrantedScopes.includes(manifest.scope)
|
|
5
|
+
).filter(
|
|
6
|
+
(manifest) => "schema" in manifest
|
|
5
7
|
).map((manifest) => manifest.schema);
|
|
6
8
|
}
|
|
9
|
+
function buildAuthorizedToolsArray(availableManifests, userGrantedScopes) {
|
|
10
|
+
const authorized = availableManifests.filter(
|
|
11
|
+
(manifest) => manifest.scope === "core" || userGrantedScopes.includes(manifest.scope)
|
|
12
|
+
);
|
|
13
|
+
const entries = [];
|
|
14
|
+
const fnSchemas = authorized.filter(
|
|
15
|
+
(manifest) => manifest.kind !== "built_in"
|
|
16
|
+
).map((manifest) => manifest.schema);
|
|
17
|
+
if (fnSchemas.length > 0) entries.push({ functionDeclarations: fnSchemas });
|
|
18
|
+
for (const manifest of authorized) {
|
|
19
|
+
if (manifest.kind === "built_in") {
|
|
20
|
+
entries.push({ [manifest.builtIn]: {} });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return entries;
|
|
24
|
+
}
|
|
7
25
|
|
|
8
26
|
// src/manifests/core.ts
|
|
9
27
|
var getCurrentTimeManifest = {
|
|
@@ -24,7 +42,13 @@ var escalateToCloudManifest = {
|
|
|
24
42
|
parameters: { type: "object", properties: {} }
|
|
25
43
|
}
|
|
26
44
|
};
|
|
45
|
+
var googleSearchManifest = {
|
|
46
|
+
name: "google_search",
|
|
47
|
+
scope: "core",
|
|
48
|
+
kind: "built_in",
|
|
49
|
+
builtIn: "google_search"
|
|
50
|
+
};
|
|
27
51
|
|
|
28
|
-
export { buildAuthorizedSchemaArray, escalateToCloudManifest, getCurrentTimeManifest };
|
|
52
|
+
export { buildAuthorizedSchemaArray, buildAuthorizedToolsArray, escalateToCloudManifest, getCurrentTimeManifest, googleSearchManifest };
|
|
29
53
|
//# sourceMappingURL=index.mjs.map
|
|
30
54
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/injector.ts","../src/manifests/core.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/injector.ts","../src/manifests/core.ts"],"names":[],"mappings":";AAaO,SAAS,0BAAA,CACd,oBACA,iBAAA,EACmB;AACnB,EAAA,OAAO,kBAAA,CACJ,MAAA;AAAA,IACC,CAAC,aACC,QAAA,CAAS,KAAA,KAAU,UAAU,iBAAA,CAAkB,QAAA,CAAS,SAAS,KAAK;AAAA,GAC1E,CACC,MAAA;AAAA,IACC,CAAC,aAA+C,QAAA,IAAY;AAAA,GAC9D,CACC,GAAA,CAAI,CAAC,QAAA,KAAa,SAAS,MAAM,CAAA;AACtC;AAYO,SAAS,yBAAA,CACd,oBACA,iBAAA,EACmB;AACnB,EAAA,MAAM,aAAa,kBAAA,CAAmB,MAAA;AAAA,IACpC,CAAC,aACC,QAAA,CAAS,KAAA,KAAU,UAAU,iBAAA,CAAkB,QAAA,CAAS,SAAS,KAAK;AAAA,GAC1E;AAEA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iltInToolName,\n FunctionToolManifest,\n} from './types';\n\n/**\n * @deprecated Use buildAuthorizedToolsArray instead — it returns the full Gemini\n * tools[] array, including built-in tools like google_search. This function only\n * ever returns function-declaration schemas; built-in manifests are ignored.\n */\nexport function buildAuthorizedSchemaArray(\n availableManifests: AgentToolManifest[],\n userGrantedScopes: string[]\n): AgentToolSchema[] {\n return availableManifests\n .filter(\n (manifest) =>\n manifest.scope === 'core' || userGrantedScopes.includes(manifest.scope)\n )\n .filter(\n (manifest): manifest is FunctionToolManifest => 'schema' in manifest\n )\n .map((manifest) => manifest.schema);\n}\n\n/** One entry of a Gemini `tools[]` array: a function-declarations group, or a built-in tool. */\nexport type GeminiToolEntry =\n | { functionDeclarations: AgentToolSchema[] }\n | { [K in BuiltInToolName]: Record<string, never> };\n\n/**\n * Filters manifests by granted scope (core-scoped manifests always pass) and\n * returns the full Gemini tools[] array: at most one functionDeclarations\n * group, plus one entry per authorized built-in tool.\n */\nexport function buildAuthorizedToolsArray(\n availableManifests: AnyAgentToolManifest[],\n userGrantedScopes: string[]\n): GeminiToolEntry[] {\n const authorized = availableManifests.filter(\n (manifest) =>\n manifest.scope === 'core' || userGrantedScopes.includes(manifest.scope)\n );\n\n const entries: GeminiToolEntry[] = [];\n\n const fnSchemas = authorized\n .filter(\n (manifest): manifest is FunctionToolManifest => manifest.kind !== 'built_in'\n )\n .map((manifest) => manifest.schema);\n if (fnSchemas.length > 0) entries.push({ functionDeclarations: fnSchemas });\n\n for (const manifest of authorized) {\n if (manifest.kind === 'built_in') {\n entries.push({ [manifest.builtIn]: {} } as GeminiToolEntry);\n }\n }\n\n return entries;\n}\n","import type { AgentToolManifest, BuiltInToolManifest } from '../types';\n\nexport const getCurrentTimeManifest: AgentToolManifest = {\n name: 'get_current_time',\n scope: 'core',\n schema: {\n name: 'get_current_time',\n description:\n 'Get the exact current date and time. Always call this tool first if resolving relative temporal words like \"today\" or \"tomorrow\".',\n parameters: { type: 'object', properties: {} },\n },\n};\n\nexport const escalateToCloudManifest: AgentToolManifest = {\n name: 'escalate_to_cloud_agent',\n scope: 'core',\n schema: {\n name: 'escalate_to_cloud_agent',\n description:\n 'Use this tool when the user asks to schedule a reminder, perform deep memory searches, or execute a complex workflow that requires cloud resources.',\n parameters: { type: 'object', properties: {} },\n },\n};\n\nexport const googleSearchManifest: BuiltInToolManifest = {\n name: 'google_search',\n scope: 'core',\n kind: 'built_in',\n builtIn: 'google_search',\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equationalapplications/core-llm-tools",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "Zero-dependency Gemini function-calling schemas and capability-scoped tool injection for edge AI agents. Works in Node.js, browser, and React Native (Hermes).",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|