@avallon-labs/mcp 21.0.0-staging.478 → 21.1.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/dist/index.js CHANGED
@@ -54,5 +54,5 @@ function setupFetch() {
54
54
 
55
55
  // src/index.ts
56
56
  setupFetch();
57
- await import("./server-KKHS7ZO4.js");
57
+ await import("./server-Z7VWGFJM.js");
58
58
  //# sourceMappingURL=index.js.map
@@ -1490,6 +1490,64 @@ var postChatMessage = async (chatId, postChatMessageBody, options) => {
1490
1490
  headers: res.headers
1491
1491
  };
1492
1492
  };
1493
+ var getListChatsUrl = (params) => {
1494
+ const normalizedParams = new URLSearchParams();
1495
+ Object.entries(params || {}).forEach(([key, value]) => {
1496
+ if (value !== void 0) {
1497
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
1498
+ for (const [sk, sv] of Object.entries(value)) {
1499
+ if (sv !== void 0) normalizedParams.append(`${key}[${sk}]`, String(sv));
1500
+ }
1501
+ } else {
1502
+ normalizedParams.append(key, value === null ? "null" : String(value));
1503
+ }
1504
+ }
1505
+ });
1506
+ const stringifiedParams = normalizedParams.toString();
1507
+ return stringifiedParams.length > 0 ? `/v1/chats?${stringifiedParams}` : `/v1/chats`;
1508
+ };
1509
+ var listChats = async (params, options) => {
1510
+ const res = await fetch(getListChatsUrl(params), {
1511
+ ...options,
1512
+ method: "GET"
1513
+ });
1514
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1515
+ const data = body ? JSON.parse(body) : {};
1516
+ return {
1517
+ data,
1518
+ status: res.status,
1519
+ headers: res.headers
1520
+ };
1521
+ };
1522
+ var getListChatMessagesUrl = (chatId, params) => {
1523
+ const normalizedParams = new URLSearchParams();
1524
+ Object.entries(params || {}).forEach(([key, value]) => {
1525
+ if (value !== void 0) {
1526
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
1527
+ for (const [sk, sv] of Object.entries(value)) {
1528
+ if (sv !== void 0) normalizedParams.append(`${key}[${sk}]`, String(sv));
1529
+ }
1530
+ } else {
1531
+ normalizedParams.append(key, value === null ? "null" : String(value));
1532
+ }
1533
+ }
1534
+ });
1535
+ const stringifiedParams = normalizedParams.toString();
1536
+ return stringifiedParams.length > 0 ? `/v1/chats/${chatId}/messages?${stringifiedParams}` : `/v1/chats/${chatId}/messages`;
1537
+ };
1538
+ var listChatMessages = async (chatId, params, options) => {
1539
+ const res = await fetch(getListChatMessagesUrl(chatId, params), {
1540
+ ...options,
1541
+ method: "GET"
1542
+ });
1543
+ const body = [204, 205, 304].includes(res.status) ? null : await res.text();
1544
+ const data = body ? JSON.parse(body) : {};
1545
+ return {
1546
+ data,
1547
+ status: res.status,
1548
+ headers: res.headers
1549
+ };
1550
+ };
1493
1551
  var getGetExtractUrl = (id) => {
1494
1552
  return `/v1/extracts/${id}`;
1495
1553
  };
@@ -2747,6 +2805,28 @@ var postChatMessageHandler = async (args) => {
2747
2805
  ]
2748
2806
  };
2749
2807
  };
2808
+ var listChatsHandler = async (args) => {
2809
+ const res = await listChats(args.queryParams);
2810
+ return {
2811
+ content: [
2812
+ {
2813
+ type: "text",
2814
+ text: JSON.stringify(res)
2815
+ }
2816
+ ]
2817
+ };
2818
+ };
2819
+ var listChatMessagesHandler = async (args) => {
2820
+ const res = await listChatMessages(args.pathParams.chatId, args.queryParams);
2821
+ return {
2822
+ content: [
2823
+ {
2824
+ type: "text",
2825
+ text: JSON.stringify(res)
2826
+ }
2827
+ ]
2828
+ };
2829
+ };
2750
2830
  var getExtractHandler = async (args) => {
2751
2831
  const res = await getExtract(args.pathParams.id);
2752
2832
  return {
@@ -5154,6 +5234,55 @@ var postChatMessageBodyContentMax = 32e3;
5154
5234
  var PostChatMessageBody = zod.object({
5155
5235
  content: zod.string().min(1).max(postChatMessageBodyContentMax)
5156
5236
  });
5237
+ var listChatsQueryCountDefault = 50;
5238
+ var listChatsQueryCountMax = 100;
5239
+ var listChatsQueryOffsetDefault = 0;
5240
+ var listChatsQueryOffsetMin = 0;
5241
+ var listChatsQuerySortByDefault = `created_at`;
5242
+ var listChatsQuerySortOrderDefault = `desc`;
5243
+ var ListChatsQueryParams = zod.object({
5244
+ count: zod.number().min(1).max(listChatsQueryCountMax).default(listChatsQueryCountDefault),
5245
+ offset: zod.number().min(listChatsQueryOffsetMin).default(listChatsQueryOffsetDefault),
5246
+ sort_by: zod.enum(["created_at"]).default(listChatsQuerySortByDefault),
5247
+ sort_order: zod.enum(["asc", "desc"]).default(listChatsQuerySortOrderDefault)
5248
+ });
5249
+ var listChatsResponseMessageCountMin = 0;
5250
+ var listChatsResponseMessageCountMax = 9007199254740991;
5251
+ var ListChatsResponseItem = zod.object({
5252
+ id: zod.string().uuid(),
5253
+ chat_agent_id: zod.string().uuid(),
5254
+ created_at: zod.string().datetime({}),
5255
+ message_count: zod.number().min(listChatsResponseMessageCountMin).max(listChatsResponseMessageCountMax)
5256
+ });
5257
+ var ListChatsResponse = zod.array(ListChatsResponseItem);
5258
+ var ListChatMessagesParams = zod.object({
5259
+ chatId: zod.string().uuid()
5260
+ });
5261
+ var listChatMessagesQueryCountDefault = 50;
5262
+ var listChatMessagesQueryCountMax = 100;
5263
+ var listChatMessagesQueryOffsetDefault = 0;
5264
+ var listChatMessagesQueryOffsetMin = 0;
5265
+ var listChatMessagesQuerySortByDefault = `generated_at`;
5266
+ var listChatMessagesQuerySortOrderDefault = `asc`;
5267
+ var ListChatMessagesQueryParams = zod.object({
5268
+ count: zod.number().min(1).max(listChatMessagesQueryCountMax).default(listChatMessagesQueryCountDefault),
5269
+ offset: zod.number().min(listChatMessagesQueryOffsetMin).default(listChatMessagesQueryOffsetDefault),
5270
+ sort_by: zod.enum(["generated_at"]).default(listChatMessagesQuerySortByDefault),
5271
+ sort_order: zod.enum(["asc", "desc"]).default(listChatMessagesQuerySortOrderDefault)
5272
+ });
5273
+ var ListChatMessagesResponseItem = zod.object({
5274
+ id: zod.string().uuid(),
5275
+ role: zod.enum(["user", "assistant", "tool", "system"]),
5276
+ content: zod.array(
5277
+ zod.object({
5278
+ type: zod.string()
5279
+ })
5280
+ ).describe(
5281
+ "Message parts (text, tool-call, tool-result, etc.). Each part has a `type` discriminator."
5282
+ ),
5283
+ generated_at: zod.string().datetime({})
5284
+ });
5285
+ var ListChatMessagesResponse = zod.array(ListChatMessagesResponseItem);
5157
5286
  var GetExtractParams = zod.object({
5158
5287
  id: zod.string().uuid()
5159
5288
  });
@@ -6283,6 +6412,23 @@ server.tool(
6283
6412
  },
6284
6413
  postChatMessageHandler
6285
6414
  );
6415
+ server.tool(
6416
+ "listChats",
6417
+ "List chats",
6418
+ {
6419
+ queryParams: ListChatsQueryParams
6420
+ },
6421
+ listChatsHandler
6422
+ );
6423
+ server.tool(
6424
+ "listChatMessages",
6425
+ "List chat messages",
6426
+ {
6427
+ pathParams: ListChatMessagesParams,
6428
+ queryParams: ListChatMessagesQueryParams
6429
+ },
6430
+ listChatMessagesHandler
6431
+ );
6286
6432
  server.tool(
6287
6433
  "getExtract",
6288
6434
  "Get extract",
@@ -6464,4 +6610,4 @@ var transport = new StdioServerTransport();
6464
6610
  server.connect(transport).then(() => {
6465
6611
  console.error("MCP server running on stdio");
6466
6612
  }).catch(console.error);
6467
- //# sourceMappingURL=server-KKHS7ZO4.js.map
6613
+ //# sourceMappingURL=server-Z7VWGFJM.js.map