@agenticmail/mcp 0.5.51 → 0.5.55
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/dist/index.js +43 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -944,25 +944,25 @@ var toolDefinitions = [
|
|
|
944
944
|
action: { type: "string", description: "create_table, list_tables, describe_table, insert, upsert, query, aggregate, update, delete_rows, truncate, drop_table, clone_table, rename_table, rename_column, add_column, drop_column, create_index, list_indexes, drop_index, reindex, archive_table, unarchive_table, export, import, sql, stats, vacuum, analyze, explain" },
|
|
945
945
|
table: { type: "string", description: "Table name" },
|
|
946
946
|
description: { type: "string", description: "For create_table: human-readable description" },
|
|
947
|
-
columns: { type: "array", description: "For create_table: [{name, type, required?, default?, unique?, primaryKey?, references?: {table, column, onDelete?}, check?}]" },
|
|
948
|
-
indexes: { type: "array", description: "For create_table: [{columns, unique?, name?, where?}]" },
|
|
947
|
+
columns: { type: "array", items: { type: "object" }, description: "For create_table: [{name, type, required?, default?, unique?, primaryKey?, references?: {table, column, onDelete?}, check?}]" },
|
|
948
|
+
indexes: { type: "array", items: { type: "object" }, description: "For create_table: [{columns, unique?, name?, where?}]" },
|
|
949
949
|
shared: { type: "boolean", description: "For create_table: shared across agents" },
|
|
950
950
|
timestamps: { type: "boolean", description: "For create_table: auto-add created_at/updated_at (default: true)" },
|
|
951
|
-
rows: { type: "array", description: "For insert/upsert/import: row objects" },
|
|
951
|
+
rows: { type: "array", items: { type: "object" }, description: "For insert/upsert/import: row objects" },
|
|
952
952
|
where: { type: "object", description: "Filter conditions with operator support" },
|
|
953
953
|
set: { type: "object", description: "For update: {column: newValue}" },
|
|
954
954
|
orderBy: { type: "string", description: "ORDER BY clause" },
|
|
955
955
|
limit: { type: "number", description: "Max rows" },
|
|
956
956
|
offset: { type: "number", description: "Skip rows" },
|
|
957
|
-
selectColumns: { type: "array", description: "Specific columns to select" },
|
|
957
|
+
selectColumns: { type: "array", items: { type: "string" }, description: "Specific columns to select" },
|
|
958
958
|
distinct: { type: "boolean", description: "SELECT DISTINCT" },
|
|
959
959
|
groupBy: { type: "string", description: "GROUP BY clause" },
|
|
960
960
|
having: { type: "string", description: "HAVING clause" },
|
|
961
|
-
operations: { type: "array", description: "For aggregate: [{fn: count|sum|avg|min|max|count_distinct, column?, alias?}]" },
|
|
961
|
+
operations: { type: "array", items: { type: "object" }, description: "For aggregate: [{fn: count|sum|avg|min|max|count_distinct, column?, alias?}]" },
|
|
962
962
|
column: { type: "object", description: "For add_column: {name, type, ...}" },
|
|
963
963
|
columnName: { type: "string", description: "For drop_column" },
|
|
964
964
|
indexName: { type: "string", description: "For create/drop_index" },
|
|
965
|
-
indexColumns: { type: "array", description: "For create_index" },
|
|
965
|
+
indexColumns: { type: "array", items: { type: "string" }, description: "For create_index" },
|
|
966
966
|
indexUnique: { type: "boolean", description: "For create_index" },
|
|
967
967
|
indexWhere: { type: "string", description: "Partial index condition" },
|
|
968
968
|
newName: { type: "string", description: "For rename_table/rename_column/clone_table" },
|
|
@@ -972,7 +972,7 @@ var toolDefinitions = [
|
|
|
972
972
|
includeData: { type: "boolean", description: "For clone_table" },
|
|
973
973
|
format: { type: "string", description: "For export: json|csv" },
|
|
974
974
|
sql: { type: "string", description: "For sql/explain: raw SQL" },
|
|
975
|
-
params: { type: "array", description: "For sql/explain: query params" },
|
|
975
|
+
params: { type: "array", items: { type: "string" }, description: "For sql/explain: query params" },
|
|
976
976
|
includeShared: { type: "boolean", description: "For list_tables" },
|
|
977
977
|
includeArchived: { type: "boolean", description: "For list_tables" }
|
|
978
978
|
},
|
|
@@ -2325,7 +2325,40 @@ ${lines.join("\n")}`;
|
|
|
2325
2325
|
import { setTelemetryVersion } from "@agenticmail/core";
|
|
2326
2326
|
import { createServer } from "http";
|
|
2327
2327
|
import { randomUUID } from "crypto";
|
|
2328
|
-
|
|
2328
|
+
import { z } from "zod";
|
|
2329
|
+
setTelemetryVersion("0.5.55");
|
|
2330
|
+
function jsonSchemaToZod(schema, topLevel = false) {
|
|
2331
|
+
if (!schema || typeof schema !== "object") return topLevel ? {} : z.any();
|
|
2332
|
+
let result;
|
|
2333
|
+
if (schema.type === "string") {
|
|
2334
|
+
result = schema.enum?.length ? z.enum(schema.enum) : z.string();
|
|
2335
|
+
} else if (schema.type === "number" || schema.type === "integer") {
|
|
2336
|
+
result = z.number();
|
|
2337
|
+
} else if (schema.type === "boolean") {
|
|
2338
|
+
result = z.boolean();
|
|
2339
|
+
} else if (schema.type === "array") {
|
|
2340
|
+
const hasItems = !!schema.items && typeof schema.items === "object" && Object.keys(schema.items).length > 0;
|
|
2341
|
+
result = z.array(hasItems ? jsonSchemaToZod(schema.items, false) : z.any());
|
|
2342
|
+
} else if (schema.type === "object") {
|
|
2343
|
+
if (!schema.properties || Object.keys(schema.properties).length === 0) {
|
|
2344
|
+
if (topLevel) return {};
|
|
2345
|
+
result = z.record(z.string(), z.any());
|
|
2346
|
+
} else {
|
|
2347
|
+
const shape = {};
|
|
2348
|
+
const required = new Set(schema.required ?? []);
|
|
2349
|
+
for (const [key, prop] of Object.entries(schema.properties)) {
|
|
2350
|
+
let child = jsonSchemaToZod(prop, false);
|
|
2351
|
+
if (!required.has(key)) child = child.optional();
|
|
2352
|
+
shape[key] = child;
|
|
2353
|
+
}
|
|
2354
|
+
if (topLevel) return shape;
|
|
2355
|
+
result = z.object(shape);
|
|
2356
|
+
}
|
|
2357
|
+
} else {
|
|
2358
|
+
result = z.any();
|
|
2359
|
+
}
|
|
2360
|
+
return schema.description ? result.describe(schema.description) : result;
|
|
2361
|
+
}
|
|
2329
2362
|
function createMcpServer() {
|
|
2330
2363
|
const server = new McpServer({
|
|
2331
2364
|
name: "\u{1F380} AgenticMail",
|
|
@@ -2336,8 +2369,8 @@ function createMcpServer() {
|
|
|
2336
2369
|
server.tool(
|
|
2337
2370
|
tool.name,
|
|
2338
2371
|
tool.description,
|
|
2339
|
-
tool.inputSchema,
|
|
2340
|
-
async (
|
|
2372
|
+
jsonSchemaToZod(tool.inputSchema, true),
|
|
2373
|
+
async (args2) => {
|
|
2341
2374
|
try {
|
|
2342
2375
|
const result = await handleToolCall(tool.name, args2);
|
|
2343
2376
|
return { content: [{ type: "text", text: result }] };
|