Compare commits

...

34 Commits

Author SHA1 Message Date
Anubhav Dhawan
57a2ade4c5 feat(npm): Bump server package versions to 0.25.0 and generate new platform-specific build artifacts. (#2284)
Releases the NPM package versions with latest toolbox release
(`v.0.25.0`).
2026-01-09 15:34:33 +05:30
Twisha Bansal
bcb3566ba3 update versions'
update versions
2026-01-09 14:32:43 +05:30
Twisha Bansal
47bbef10c5 update version 2026-01-09 14:32:43 +05:30
Twisha Bansal
44e782371e script for server release 2026-01-09 14:32:43 +05:30
Twisha Bansal
705be4018d update dep versions 2026-01-09 14:32:43 +05:30
Twisha Bansal
c968ed8925 rename file 2026-01-09 14:32:43 +05:30
Twisha Bansal
6f5911288d release dep package script 2026-01-09 14:32:43 +05:30
Twisha Bansal
cf42389d39 add script to update server packages 2026-01-09 14:32:43 +05:30
Twisha Bansal
49cb83ca5d update versions 2026-01-09 14:32:43 +05:30
Twisha Bansal
961c4726c7 bump version 2026-01-09 14:32:43 +05:30
Twisha Bansal
6e961ad48b update supported platforms 2026-01-09 14:32:43 +05:30
Twisha Bansal
d5a9031a65 bump version 2026-01-09 14:32:43 +05:30
Twisha Bansal
669b9b3b5d update linux package versions 2026-01-09 14:32:43 +05:30
Twisha Bansal
7bf04ddbb1 fix server package 2026-01-09 14:32:43 +05:30
Twisha Bansal
2705cf642c update server versions 2026-01-09 14:32:43 +05:30
Twisha Bansal
fb8f757eaf upate version 2026-01-09 14:32:43 +05:30
Twisha Bansal
6731e25cff remove apple quarantine 2026-01-09 14:32:43 +05:30
Twisha Bansal
0aece20ada Update downloadBinary.js 2026-01-09 14:32:43 +05:30
Twisha Bansal
401d0307d5 Update downloadBinary.js 2026-01-09 14:32:43 +05:30
Twisha Bansal
7479f5b871 Update downloadBinary.js 2026-01-09 14:32:43 +05:30
Twisha Bansal
a61a1d78a3 Update downloadBinary.js 2026-01-09 14:32:43 +05:30
Twisha Bansal
2fbf51968d Update testing.md 2026-01-09 14:32:43 +05:30
Twisha Bansal
54b56ee7cc fix 2026-01-09 14:32:43 +05:30
Twisha Bansal
39615a6011 fix path 2026-01-09 14:32:43 +05:30
Twisha Bansal
83562eb5ec fix package.json 2026-01-09 14:32:43 +05:30
Twisha Bansal
bb76fc6a84 fix testing 2026-01-09 14:32:43 +05:30
Twisha Bansal
21e4db2ed4 Update testing.md 2026-01-09 14:32:43 +05:30
Twisha Bansal
05e075b3fe Update testing.md 2026-01-09 14:32:43 +05:30
Twisha Bansal
e94eebc6af fix package 2026-01-09 14:32:43 +05:30
Twisha Bansal
e50dc777b7 Fixed readme 2026-01-09 14:32:43 +05:30
Twisha Bansal
1aaa84313c add markdown on how to test 2026-01-09 14:32:43 +05:30
Twisha Bansal
829e3168ff fix 2026-01-09 14:32:43 +05:30
Twisha Bansal
3d76f60401 fix 2026-01-09 14:32:43 +05:30
Twisha Bansal
d065b41598 add files 2026-01-09 14:32:43 +05:30
29 changed files with 892 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
cd server-darwin-arm64
npm pack .
npm publish --access public
cd ../server-darwin-x64
npm pack .
npm publish --access public
cd ../server-linux-x64
npm pack .
npm publish --access public
cd ../server-win32-x64
npm pack .
npm publish --access public

View File

@@ -0,0 +1,6 @@
# @toolbox-sdk/server-darwin-arm64
Platform-specific binary for the `toolbox` package on Darwin arm64.
This package is automatically installed by the main `@toolbox-sdk/server` package and is not intended to be installed directly.
For more information, visit the [toolbox npm package](https://www.npmjs.com/package/@toolbox-sdk/server).

View File

@@ -0,0 +1,19 @@
{
"name": "@toolbox-sdk/server-darwin-arm64",
"version": "0.25.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@toolbox-sdk/server-darwin-arm64",
"version": "0.25.0",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"os": [
"darwin"
]
}
}
}

View File

@@ -0,0 +1,20 @@
{
"name": "@toolbox-sdk/server-darwin-arm64",
"version": "0.25.0",
"license": "Apache-2.0",
"author": "Google LLC",
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "bin/toolbox",
"repository": "googleapis/genai-toolbox",
"scripts": {
"prepack": "node scripts/downloadBinary.js darwin arm64"
},
"files": [
"bin/toolbox"
]
}

View File

@@ -0,0 +1,85 @@
const fs = require('fs');
const path = require('path');
const https = require('https');
const { execSync } = require('child_process');
// 1. Configuration
const PLATFORM_MAP = {
'linux': 'linux',
'darwin': 'darwin',
'win32': 'windows'
};
const ARCH_MAP = {
'x64': 'amd64',
'arm64': 'arm64'
};
const args = process.argv.slice(2);
if (args.length < 2) {
console.error("Usage: node download-binary.js <platform> <arch>");
process.exit(1);
}
const [targetPlatform, targetArch] = args;
// 2. Determine Version
const version = fs.readFileSync(path.join(process.cwd(), 'version.txt'), 'utf8').trim();
// 3. Construct URL
const gcsPlatform = PLATFORM_MAP[targetPlatform];
const gcsArch = ARCH_MAP[targetArch];
if (!gcsPlatform || !gcsArch) {
console.error(`Unsupported platform/arch: ${targetPlatform}/${targetArch}`);
process.exit(1);
}
const extension = targetPlatform === 'win32' ? '.exe' : '';
const binaryName = `toolbox${extension}`;
const url = `https://storage.googleapis.com/genai-toolbox/v${version}/${gcsPlatform}/${gcsArch}/${binaryName}`;
// 4. Prepare Output
const binDir = path.join(process.cwd(), 'bin');
if (!fs.existsSync(binDir)) {
fs.mkdirSync(binDir, { recursive: true });
}
const destPath = path.join(binDir, binaryName);
if (fs.existsSync(destPath)) {
console.log(`[Skipped] Binary already exists at ${destPath}`);
process.exit(0);
}
console.log(`[Prepack] Downloading ${binaryName} for ${targetPlatform}/${targetArch}...`);
console.log(`[Source] ${url}`);
// 5. Download Function
const file = fs.createWriteStream(destPath);
https.get(url, function(response) {
if (response.statusCode !== 200) {
console.error(`❌ Failed to download. Status Code: ${response.statusCode}`);
fs.unlink(destPath, () => {}); // Delete partial file
process.exit(1);
}
response.pipe(file);
file.on('finish', () => {
file.close(() => {
// 6. Make executable (Unix only)
if (targetPlatform !== 'win32') {
try {
execSync(`chmod +x "${destPath}"`);
} catch (err) {
console.warn("⚠️ Could not set executable permissions (chmod failed).");
}
}
console.log(`✅ Success! Binary saved to ${destPath}`);
});
});
}).on('error', function(err) {
fs.unlink(destPath, () => {});
console.error(`❌ Download Error: ${err.message}`);
process.exit(1);
});

View File

@@ -0,0 +1 @@
0.25.0

View File

@@ -0,0 +1,6 @@
# @toolbox-sdk/server-darwin-x64
Platform-specific binary for the `toolbox` package on Darwin x64.
This package is automatically installed by the main `@toolbox-sdk/server` package and is not intended to be installed directly.
For more information, visit the [toolbox npm package](https://www.npmjs.com/package/@toolbox-sdk/server).

View File

@@ -0,0 +1,19 @@
{
"name": "@toolbox-sdk/server-darwin-x64",
"version": "0.25.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@toolbox-sdk/server-darwin-x64",
"version": "0.25.0",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"os": [
"darwin"
]
}
}
}

View File

@@ -0,0 +1,20 @@
{
"name": "@toolbox-sdk/server-darwin-x64",
"version": "0.25.0",
"license": "Apache-2.0",
"author": "Google LLC",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "bin/toolbox",
"repository": "googleapis/genai-toolbox",
"scripts": {
"prepack": "node scripts/downloadBinary.js darwin x64"
},
"files": [
"bin/toolbox"
]
}

View File

@@ -0,0 +1,85 @@
const fs = require('fs');
const path = require('path');
const https = require('https');
const { execSync } = require('child_process');
// 1. Configuration
const PLATFORM_MAP = {
'linux': 'linux',
'darwin': 'darwin',
'win32': 'windows'
};
const ARCH_MAP = {
'x64': 'amd64',
'arm64': 'arm64'
};
const args = process.argv.slice(2);
if (args.length < 2) {
console.error("Usage: node download-binary.js <platform> <arch>");
process.exit(1);
}
const [targetPlatform, targetArch] = args;
// 2. Determine Version
const version = fs.readFileSync(path.join(process.cwd(), 'version.txt'), 'utf8').trim();
// 3. Construct URL
const gcsPlatform = PLATFORM_MAP[targetPlatform];
const gcsArch = ARCH_MAP[targetArch];
if (!gcsPlatform || !gcsArch) {
console.error(`Unsupported platform/arch: ${targetPlatform}/${targetArch}`);
process.exit(1);
}
const extension = targetPlatform === 'win32' ? '.exe' : '';
const binaryName = `toolbox${extension}`;
const url = `https://storage.googleapis.com/genai-toolbox/v${version}/${gcsPlatform}/${gcsArch}/${binaryName}`;
// 4. Prepare Output
const binDir = path.join(process.cwd(), 'bin');
if (!fs.existsSync(binDir)) {
fs.mkdirSync(binDir, { recursive: true });
}
const destPath = path.join(binDir, binaryName);
if (fs.existsSync(destPath)) {
console.log(`[Skipped] Binary already exists at ${destPath}`);
process.exit(0);
}
console.log(`[Prepack] Downloading ${binaryName} for ${targetPlatform}/${targetArch}...`);
console.log(`[Source] ${url}`);
// 5. Download Function
const file = fs.createWriteStream(destPath);
https.get(url, function(response) {
if (response.statusCode !== 200) {
console.error(`❌ Failed to download. Status Code: ${response.statusCode}`);
fs.unlink(destPath, () => {}); // Delete partial file
process.exit(1);
}
response.pipe(file);
file.on('finish', () => {
file.close(() => {
// 6. Make executable (Unix only)
if (targetPlatform !== 'win32') {
try {
execSync(`chmod +x "${destPath}"`);
} catch (err) {
console.warn("⚠️ Could not set executable permissions (chmod failed).");
}
}
console.log(`✅ Success! Binary saved to ${destPath}`);
});
});
}).on('error', function(err) {
fs.unlink(destPath, () => {});
console.error(`❌ Download Error: ${err.message}`);
process.exit(1);
});

View File

@@ -0,0 +1 @@
0.25.0

View File

@@ -0,0 +1,7 @@
# @toolbox-sdk/server-linux-x64
Platform-specific binary for the `toolbox` package on Linux x64.
This package is automatically installed by the main `@toolbox-sdk/server` package and is not intended to be installed directly.
For more information, visit the [toolbox npm package](https://www.npmjs.com/package/@toolbox-sdk/server).

View File

@@ -0,0 +1,19 @@
{
"name": "@toolbox-sdk/server-linux-x64",
"version": "0.25.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@toolbox-sdk/server-linux-x64",
"version": "0.25.0",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"os": [
"linux"
]
}
}
}

View File

@@ -0,0 +1,20 @@
{
"name": "@toolbox-sdk/server-linux-x64",
"version": "0.25.0",
"license": "Apache-2.0",
"author": "Google LLC",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "bin/toolbox",
"repository": "googleapis/genai-toolbox",
"scripts": {
"prepack": "node scripts/downloadBinary.js linux x64"
},
"files": [
"bin/toolbox"
]
}

View File

@@ -0,0 +1,85 @@
const fs = require('fs');
const path = require('path');
const https = require('https');
const { execSync } = require('child_process');
// 1. Configuration
const PLATFORM_MAP = {
'linux': 'linux',
'darwin': 'darwin',
'win32': 'windows'
};
const ARCH_MAP = {
'x64': 'amd64',
'arm64': 'arm64'
};
const args = process.argv.slice(2);
if (args.length < 2) {
console.error("Usage: node download-binary.js <platform> <arch>");
process.exit(1);
}
const [targetPlatform, targetArch] = args;
// 2. Determine Version
const version = fs.readFileSync(path.join(process.cwd(), 'version.txt'), 'utf8').trim();
// 3. Construct URL
const gcsPlatform = PLATFORM_MAP[targetPlatform];
const gcsArch = ARCH_MAP[targetArch];
if (!gcsPlatform || !gcsArch) {
console.error(`Unsupported platform/arch: ${targetPlatform}/${targetArch}`);
process.exit(1);
}
const extension = targetPlatform === 'win32' ? '.exe' : '';
const binaryName = `toolbox${extension}`;
const url = `https://storage.googleapis.com/genai-toolbox/v${version}/${gcsPlatform}/${gcsArch}/${binaryName}`;
// 4. Prepare Output
const binDir = path.join(process.cwd(), 'bin');
if (!fs.existsSync(binDir)) {
fs.mkdirSync(binDir, { recursive: true });
}
const destPath = path.join(binDir, binaryName);
if (fs.existsSync(destPath)) {
console.log(`[Skipped] Binary already exists at ${destPath}`);
process.exit(0);
}
console.log(`[Prepack] Downloading ${binaryName} for ${targetPlatform}/${targetArch}...`);
console.log(`[Source] ${url}`);
// 5. Download Function
const file = fs.createWriteStream(destPath);
https.get(url, function(response) {
if (response.statusCode !== 200) {
console.error(`❌ Failed to download. Status Code: ${response.statusCode}`);
fs.unlink(destPath, () => {}); // Delete partial file
process.exit(1);
}
response.pipe(file);
file.on('finish', () => {
file.close(() => {
// 6. Make executable (Unix only)
if (targetPlatform !== 'win32') {
try {
execSync(`chmod +x "${destPath}"`);
} catch (err) {
console.warn("⚠️ Could not set executable permissions (chmod failed).");
}
}
console.log(`✅ Success! Binary saved to ${destPath}`);
});
});
}).on('error', function(err) {
fs.unlink(destPath, () => {});
console.error(`❌ Download Error: ${err.message}`);
process.exit(1);
});

View File

@@ -0,0 +1 @@
0.25.0

View File

@@ -0,0 +1,7 @@
# @toolbox-sdk/server-win32-x64
Platform-specific binary for the `toolbox` package on Windows x64.
This package is automatically installed by the main `@toolbox-sdk/server` package and is not intended to be installed directly.
For more information, visit the [toolbox npm package](https://www.npmjs.com/package/@toolbox-sdk/server).

View File

@@ -0,0 +1,19 @@
{
"name": "@toolbox-sdk/server-win32-x64",
"version": "0.25.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@toolbox-sdk/server-win32-x64",
"version": "0.25.0",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"os": [
"win32"
]
}
}
}

View File

@@ -0,0 +1,20 @@
{
"name": "@toolbox-sdk/server-win32-x64",
"version": "0.25.0",
"license": "Apache-2.0",
"author": "Google LLC",
"os": [
"win32"
],
"cpu": [
"x64"
],
"main": "bin/toolbox.exe",
"repository": "googleapis/genai-toolbox",
"scripts": {
"prepack": "node scripts/downloadBinary.js win32 x64"
},
"files": [
"bin/toolbox.exe"
]
}

View File

@@ -0,0 +1,85 @@
const fs = require('fs');
const path = require('path');
const https = require('https');
const { execSync } = require('child_process');
// 1. Configuration
const PLATFORM_MAP = {
'linux': 'linux',
'darwin': 'darwin',
'win32': 'windows'
};
const ARCH_MAP = {
'x64': 'amd64',
'arm64': 'arm64'
};
const args = process.argv.slice(2);
if (args.length < 2) {
console.error("Usage: node download-binary.js <platform> <arch>");
process.exit(1);
}
const [targetPlatform, targetArch] = args;
// 2. Determine Version
const version = fs.readFileSync(path.join(process.cwd(), 'version.txt'), 'utf8').trim();
// 3. Construct URL
const gcsPlatform = PLATFORM_MAP[targetPlatform];
const gcsArch = ARCH_MAP[targetArch];
if (!gcsPlatform || !gcsArch) {
console.error(`Unsupported platform/arch: ${targetPlatform}/${targetArch}`);
process.exit(1);
}
const extension = targetPlatform === 'win32' ? '.exe' : '';
const binaryName = `toolbox${extension}`;
const url = `https://storage.googleapis.com/genai-toolbox/v${version}/${gcsPlatform}/${gcsArch}/${binaryName}`;
// 4. Prepare Output
const binDir = path.join(process.cwd(), 'bin');
if (!fs.existsSync(binDir)) {
fs.mkdirSync(binDir, { recursive: true });
}
const destPath = path.join(binDir, binaryName);
if (fs.existsSync(destPath)) {
console.log(`[Skipped] Binary already exists at ${destPath}`);
process.exit(0);
}
console.log(`[Prepack] Downloading ${binaryName} for ${targetPlatform}/${targetArch}...`);
console.log(`[Source] ${url}`);
// 5. Download Function
const file = fs.createWriteStream(destPath);
https.get(url, function(response) {
if (response.statusCode !== 200) {
console.error(`❌ Failed to download. Status Code: ${response.statusCode}`);
fs.unlink(destPath, () => {}); // Delete partial file
process.exit(1);
}
response.pipe(file);
file.on('finish', () => {
file.close(() => {
// 6. Make executable (Unix only)
if (targetPlatform !== 'win32') {
try {
execSync(`chmod +x "${destPath}"`);
} catch (err) {
console.warn("⚠️ Could not set executable permissions (chmod failed).");
}
}
console.log(`✅ Success! Binary saved to ${destPath}`);
});
});
}).on('error', function(err) {
fs.unlink(destPath, () => {});
console.error(`❌ Download Error: ${err.message}`);
process.exit(1);
});

View File

@@ -0,0 +1 @@
0.25.0

69
packages/server/README.md Normal file
View File

@@ -0,0 +1,69 @@
# Toolbox
A CLI tool for running a toolbox server.
## Installation
You can install the toolbox globally:
```bash
npm install -g @toolbox-sdk/server
```
Or run it directly using npx:
```bash
npx @toolbox-sdk/server
```
## Configuration
The toolbox requires a `tools.yaml` file in the current working directory to define sources, tools, and prompts.
### Example `tools.yaml`
```yaml
sources:
my-pg-source:
kind: postgres
host: 127.0.0.1
port: 5432
database: toolbox_db
user: postgres
password: password
tools:
search-hotels-by-name:
kind: postgres-sql
source: my-pg-source
description: Search for hotels based on name.
parameters:
- name: name
type: string
description: The name of the hotel.
statement: SELECT * FROM hotels WHERE name ILIKE '%' || $1 || '%';
prompts:
code-review:
description: "Asks the LLM to analyze code quality and suggest improvements."
messages:
- role: "user"
content: "Please review the following code for quality, correctness, and potential improvements: \n\n{{.code}}"
arguments:
- name: "code"
description: "The code to review"
required: true
```
To learn more on how to configure your toolbox, visit the [official docsite](https://googleapis.github.io/genai-toolbox/getting-started/configure/).
## Platform Support
The toolbox automatically handles platform-specific binaries. Supported platforms include:
- macOS (arm64, x64)
- Linux (x64)
- Windows (x64)
## Resources
For more information, visit the
- [MCP Toolbox repository](https://github.com/googleapis/genai-toolbox)
- [Official Documentation](https://googleapis.github.io/genai-toolbox/getting-started/introduction/)

49
packages/server/bin/run.js Executable file
View File

@@ -0,0 +1,49 @@
#!/usr/bin/env node
const { spawn } = require('child_process');
const path = require('path');
const os = require('os');
const fs = require('fs');
const PLATFORMS = {
'darwin-arm64': '@toolbox-sdk/server-darwin-arm64',
'darwin-x64': '@toolbox-sdk/server-darwin-x64',
'linux-x64': '@toolbox-sdk/server-linux-x64',
'win32-x64': '@toolbox-sdk/server-win32-x64'
};
const currentKey = `${os.platform()}-${os.arch()}`;
const pkgName = PLATFORMS[currentKey];
if (!pkgName) {
console.error(`Unsupported platform: ${currentKey}`);
process.exit(1);
}
let binPath;
try {
const pkgJsonPath = require.resolve(`${pkgName}/package.json`);
const pkgDir = path.dirname(pkgJsonPath);
const binName = os.platform() === 'win32' ? 'toolbox.exe' : 'toolbox';
binPath = path.join(pkgDir, 'bin', binName);
} catch (e) {
console.error(`Binary for ${currentKey} not found. Installation failed?`);
process.exit(1);
}
if (os.platform() !== 'win32') {
try {
fs.chmodSync(binPath, 0o755);
if (os.platform() === 'darwin') {
const { execSync } = require('child_process');
try {
execSync(`xattr -d com.apple.quarantine "${binPath}"`, { stdio: 'ignore' });
} catch (e) {
}
}
} catch (e) {
console.warn(`Could not set execute permissions on ${binPath}: ${e.message}`);
}
}
spawn(binPath, process.argv.slice(2), { stdio: 'inherit' })
.on('exit', process.exit);

74
packages/server/package-lock.json generated Normal file
View File

@@ -0,0 +1,74 @@
{
"name": "@toolbox-sdk/server",
"version": "0.25.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@toolbox-sdk/server",
"version": "0.25.0",
"license": "Apache-2.0",
"bin": {
"toolbox": "bin/run.js"
},
"optionalDependencies": {
"@toolbox-sdk/server-darwin-arm64": "0.25.0",
"@toolbox-sdk/server-darwin-x64": "0.25.0",
"@toolbox-sdk/server-linux-x64": "0.25.0",
"@toolbox-sdk/server-win32-x64": "0.25.0"
}
},
"node_modules/@toolbox-sdk/server-darwin-arm64": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/@toolbox-sdk/server-darwin-arm64/-/server-darwin-arm64-0.25.0.tgz",
"integrity": "sha512-HNAfaDOg2ggnZObJkh5JxoUtfL0WiA2nvDB7qNMdP3130Jgrc9y6rjpGVgN0ntk9zPhioussfbDDgc36jUTq+g==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@toolbox-sdk/server-darwin-x64": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/@toolbox-sdk/server-darwin-x64/-/server-darwin-x64-0.25.0.tgz",
"integrity": "sha512-RG7rcfuA8jFylbdT0geXWGKtLBfsqXtwDR2kgJtr5hjdFqjhOwuN6jK0JNnjyHZoBx6xN6cG4nHs25uEWjrD9g==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@toolbox-sdk/server-linux-x64": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/@toolbox-sdk/server-linux-x64/-/server-linux-x64-0.25.0.tgz",
"integrity": "sha512-V/yjAcEJD4vxLyHXgkdUM6Wc8agma451O6Ms9loEfcIwwIWnb103UOOiZRd+pLdDViuuSzrhXNEH62vjhIoQUw==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@toolbox-sdk/server-win32-x64": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/@toolbox-sdk/server-win32-x64/-/server-win32-x64-0.25.0.tgz",
"integrity": "sha512-QUgPeWvHhD2lLqp4Tk1bDuEOu8l6y5ApsnTScEMIa2GO7G/jRJzkCT1TNZJIUxQMZEEXy38bn9x/fMMtNN9flQ==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"win32"
]
}
}
}

View File

@@ -0,0 +1,19 @@
{
"name": "@toolbox-sdk/server",
"version": "0.25.0",
"license": "Apache-2.0",
"author": "Google LLC",
"bin": {
"toolbox": "./bin/run.js"
},
"files": [
"bin/run.js"
],
"repository": "googleapis/genai-toolbox",
"optionalDependencies": {
"@toolbox-sdk/server-darwin-arm64": "0.25.0",
"@toolbox-sdk/server-darwin-x64": "0.25.0",
"@toolbox-sdk/server-linux-x64": "0.25.0",
"@toolbox-sdk/server-win32-x64": "0.25.0"
}
}

91
packages/testing.md Normal file
View File

@@ -0,0 +1,91 @@
# How to test on different platforms
1. Create a local test registry. We are using Verdaccio. During the actual process, we publish to npm instead.
```sh
# install
npm install -g verdaccio
# start server
verdaccio
```
The output will show the config file location and the URL. Open your browser to:
http://localhost:4873
> Note: You can use `npm unpublish @toolbox-sdk/server --force --registry http://localhost:4873` to unpublish the package.
2. Pack all 4 packages and publish them to the local registry. Go in each package (eg. server-darwin-arm64) and run
```sh
npm ci --force
npm pack .
```
Then publish to the local registry
```sh
npm publish --registry http://localhost:4873
```
3. Go to the server package and run
```sh
npm ci --force
npm pack .
npm publish --registry http://localhost:4873
```
Now, you have published your package.
4. Now create a new folder (let's call it testing.) Add a tools.yaml file to the folder. It should look like this:
```yaml
sources:
my-pg-source:
kind: postgres
host: 127.0.0.1
port: 5432
database: toolbox_db
user: postgres
password: password
tools:
search-hotels-by-name:
kind: postgres-sql
source: my-pg-source
description: Search for hotels based on name.
parameters:
- name: name
type: string
description: The name of the hotel.
statement: SELECT * FROM hotels WHERE name ILIKE '%' || $1 || '%';
prompts:
code-review:
description: "Asks the LLM to analyze code quality and suggest improvements."
messages:
- role: "user"
content: "Please review the following code for quality, correctness, and potential improvements: \n\n{{.code}}"
arguments:
- name: "code"
description: "The code to review"
required: true
```
Note: Do not test this directly to the server folder. The registry might pick up local packages instead of global installation.
Use a separate testing folder outside the server folder for this testing.
6. From the testing folder, run
```sh
npx --registry=http://localhost:4873/ -y @toolbox-sdk/server
```
This should start up the toolbox server with the tools.yaml file.
7. Run the command to verify that the tools are available:
```sh
curl --location 'http://127.0.0.1:5000/mcp' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "tools/list",
"params": {},
"id": 1
}'
```

21
packages/update_dep_packages.sh Executable file
View File

@@ -0,0 +1,21 @@
cd server-darwin-arm64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json
cd ../server-darwin-x64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json
cd ../server-linux-x64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json
cd ../server-win32-x64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json

View File

@@ -0,0 +1,7 @@
cd server
npm install --package-lock-only
git add package.json package-lock.json
git commit -m "update dep versions"
npm pack .
npm publish --access public

View File

@@ -0,0 +1,21 @@
cd server-darwin-arm64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json
cd ../server-darwin-x64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json
cd ../server-linux-x64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json
cd ../server-win32-x64
npm install --force
rm -rf bin/
git add version.txt package.json package-lock.json