@wisewandtools/mcp-server 2.2.0 → 2.2.1
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 +158 -97
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1169,6 +1169,42 @@ var HealthChecker = class {
|
|
|
1169
1169
|
|
|
1170
1170
|
// src/handlers/tools/ArticleToolHandler.ts
|
|
1171
1171
|
import { z as z2 } from "zod";
|
|
1172
|
+
|
|
1173
|
+
// src/utils/tool-helpers.ts
|
|
1174
|
+
var UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
1175
|
+
var ToolInputError = class extends Error {
|
|
1176
|
+
static {
|
|
1177
|
+
__name(this, "ToolInputError");
|
|
1178
|
+
}
|
|
1179
|
+
constructor(message) {
|
|
1180
|
+
super(message);
|
|
1181
|
+
this.name = "ToolInputError";
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1184
|
+
function resolveId(args, ...fallbackKeys) {
|
|
1185
|
+
const value = args.id ?? args.Id ?? args.ID;
|
|
1186
|
+
if (value !== void 0 && value !== null) {
|
|
1187
|
+
return validateUuid(value);
|
|
1188
|
+
}
|
|
1189
|
+
for (const key of fallbackKeys) {
|
|
1190
|
+
if (args[key] !== void 0 && args[key] !== null) {
|
|
1191
|
+
return validateUuid(args[key]);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
const tried = ["id", ...fallbackKeys].join(", ");
|
|
1195
|
+
throw new ToolInputError(`Missing required ID. Provide one of: ${tried}`);
|
|
1196
|
+
}
|
|
1197
|
+
__name(resolveId, "resolveId");
|
|
1198
|
+
function validateUuid(value) {
|
|
1199
|
+
const str = String(value);
|
|
1200
|
+
if (!UUID_REGEX.test(str)) {
|
|
1201
|
+
throw new ToolInputError(`Invalid ID format: "${str}" is not a valid UUID`);
|
|
1202
|
+
}
|
|
1203
|
+
return str;
|
|
1204
|
+
}
|
|
1205
|
+
__name(validateUuid, "validateUuid");
|
|
1206
|
+
|
|
1207
|
+
// src/handlers/tools/ArticleToolHandler.ts
|
|
1172
1208
|
var boolField = z2.union([z2.boolean(), z2.string()]).transform(
|
|
1173
1209
|
(val) => typeof val === "string" ? val === "true" : val
|
|
1174
1210
|
).optional().default(false);
|
|
@@ -1548,8 +1584,8 @@ var ArticleToolHandler = class {
|
|
|
1548
1584
|
title: article.title || "Article created",
|
|
1549
1585
|
message: `Article "${article.title || validated.subject}" created successfully.`,
|
|
1550
1586
|
next_steps: [
|
|
1551
|
-
`Use 'generate_article' with
|
|
1552
|
-
`Use 'get_article' with
|
|
1587
|
+
`Use 'generate_article' with id: ${article.id} to start content generation`,
|
|
1588
|
+
`Use 'get_article' with id: ${article.id} to check status`
|
|
1553
1589
|
]
|
|
1554
1590
|
}, null, 2)
|
|
1555
1591
|
}]
|
|
@@ -1572,15 +1608,16 @@ var ArticleToolHandler = class {
|
|
|
1572
1608
|
inputSchema: {
|
|
1573
1609
|
type: "object",
|
|
1574
1610
|
properties: {
|
|
1575
|
-
|
|
1611
|
+
id: { type: "string", format: "uuid", description: "ID of the article to generate" },
|
|
1576
1612
|
wait_for_completion: { type: "boolean", description: "Wait for generation to complete (may take several minutes)", default: true },
|
|
1577
1613
|
max_wait_time: { type: "number", description: "Maximum time to wait in seconds", default: 300, maximum: 600 }
|
|
1578
1614
|
},
|
|
1579
|
-
required: ["
|
|
1615
|
+
required: ["id"]
|
|
1580
1616
|
},
|
|
1581
1617
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
1582
1618
|
try {
|
|
1583
|
-
const
|
|
1619
|
+
const article_id = resolveId(args, "article_id");
|
|
1620
|
+
const { wait_for_completion = true, max_wait_time = 300 } = args;
|
|
1584
1621
|
await this.apiClient.runArticleGeneration(article_id);
|
|
1585
1622
|
if (!wait_for_completion) {
|
|
1586
1623
|
return { content: [{ type: "text", text: JSON.stringify({ success: true, message: "Article generation started", article_id, next_step: `Use 'get_article' or 'get_article_output' to check status` }, null, 2) }] };
|
|
@@ -1631,12 +1668,12 @@ var ArticleToolHandler = class {
|
|
|
1631
1668
|
description: "Get article details and status",
|
|
1632
1669
|
inputSchema: {
|
|
1633
1670
|
type: "object",
|
|
1634
|
-
properties: {
|
|
1635
|
-
required: ["
|
|
1671
|
+
properties: { id: { type: "string", format: "uuid", description: "ID of the article to retrieve" } },
|
|
1672
|
+
required: ["id"]
|
|
1636
1673
|
},
|
|
1637
1674
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
1638
1675
|
try {
|
|
1639
|
-
const
|
|
1676
|
+
const article_id = resolveId(args, "article_id");
|
|
1640
1677
|
const cached = await this.cache.get(`article:${article_id}`);
|
|
1641
1678
|
if (cached) {
|
|
1642
1679
|
return { content: [{ type: "text", text: JSON.stringify({ success: true, article: cached, from_cache: true }, null, 2) }] };
|
|
@@ -1662,8 +1699,7 @@ var ArticleToolHandler = class {
|
|
|
1662
1699
|
properties: {
|
|
1663
1700
|
search: { type: "string", description: "Search term to filter articles" },
|
|
1664
1701
|
status: { type: "string", description: "Filter by status" },
|
|
1665
|
-
|
|
1666
|
-
project_id: { type: "string", format: "uuid", description: "Filter by project (alias)" },
|
|
1702
|
+
project_id: { type: "string", format: "uuid", description: "Filter by project" },
|
|
1667
1703
|
maker: { type: "string", description: "Filter by maker" },
|
|
1668
1704
|
persona: { type: "string", description: "Filter by persona" },
|
|
1669
1705
|
author: { type: "string", description: "Filter by author" },
|
|
@@ -1677,7 +1713,12 @@ var ArticleToolHandler = class {
|
|
|
1677
1713
|
},
|
|
1678
1714
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
1679
1715
|
try {
|
|
1680
|
-
const
|
|
1716
|
+
const apiParams = { ...args };
|
|
1717
|
+
if (apiParams.project_id) {
|
|
1718
|
+
apiParams.projectId = apiParams.project_id;
|
|
1719
|
+
delete apiParams.project_id;
|
|
1720
|
+
}
|
|
1721
|
+
const result2 = await this.apiClient.listArticles(apiParams);
|
|
1681
1722
|
this.metrics.recordAPICall("list_articles", "success");
|
|
1682
1723
|
return {
|
|
1683
1724
|
content: [{
|
|
@@ -1686,7 +1727,17 @@ var ArticleToolHandler = class {
|
|
|
1686
1727
|
success: true,
|
|
1687
1728
|
total: result2.total,
|
|
1688
1729
|
count: result2.items.length,
|
|
1689
|
-
articles: result2.items.map((a) => ({
|
|
1730
|
+
articles: result2.items.map((a) => ({
|
|
1731
|
+
id: a.id,
|
|
1732
|
+
title: a.title,
|
|
1733
|
+
status: a.status,
|
|
1734
|
+
created_at: a.created_at,
|
|
1735
|
+
type: a.data?.input?.type,
|
|
1736
|
+
project_id: a.data?.input?.project_id,
|
|
1737
|
+
target_keyword: a.data?.input?.target_keyword,
|
|
1738
|
+
lang: a.data?.input?.lang,
|
|
1739
|
+
subject: a.data?.input?.subject
|
|
1740
|
+
})),
|
|
1690
1741
|
pagination: { skip: result2.skip, take: result2.take, has_more: result2.skip + result2.take < result2.total }
|
|
1691
1742
|
}, null, 2)
|
|
1692
1743
|
}]
|
|
@@ -1706,18 +1757,19 @@ var ArticleToolHandler = class {
|
|
|
1706
1757
|
inputSchema: {
|
|
1707
1758
|
type: "object",
|
|
1708
1759
|
properties: {
|
|
1709
|
-
|
|
1760
|
+
id: { type: "string", format: "uuid", description: "ID of the article to update" },
|
|
1710
1761
|
updates: {
|
|
1711
1762
|
type: "object",
|
|
1712
1763
|
description: "Fields to update (supports all create_article parameters)",
|
|
1713
1764
|
properties: this.buildArticleInputSchema()
|
|
1714
1765
|
}
|
|
1715
1766
|
},
|
|
1716
|
-
required: ["
|
|
1767
|
+
required: ["id", "updates"]
|
|
1717
1768
|
},
|
|
1718
1769
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
1719
1770
|
try {
|
|
1720
|
-
const
|
|
1771
|
+
const article_id = resolveId(args, "article_id");
|
|
1772
|
+
const { updates } = args;
|
|
1721
1773
|
await this.apiClient.updateArticle(article_id, updates);
|
|
1722
1774
|
await this.cache.delete(`article:${article_id}`);
|
|
1723
1775
|
this.metrics.recordAPICall("update_article", "success");
|
|
@@ -1739,14 +1791,15 @@ var ArticleToolHandler = class {
|
|
|
1739
1791
|
inputSchema: {
|
|
1740
1792
|
type: "object",
|
|
1741
1793
|
properties: {
|
|
1742
|
-
|
|
1794
|
+
id: { type: "string", format: "uuid", description: "ID of the article" },
|
|
1743
1795
|
format: { type: "string", enum: ["full", "html", "markdown", "summary"], description: "Output format", default: "full" }
|
|
1744
1796
|
},
|
|
1745
|
-
required: ["
|
|
1797
|
+
required: ["id"]
|
|
1746
1798
|
},
|
|
1747
1799
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
1748
1800
|
try {
|
|
1749
|
-
const
|
|
1801
|
+
const article_id = resolveId(args, "article_id");
|
|
1802
|
+
const { format = "full" } = args;
|
|
1750
1803
|
const cacheKey = `article:output:${article_id}`;
|
|
1751
1804
|
const cached = await this.cache.get(cacheKey);
|
|
1752
1805
|
const output = cached || await this.apiClient.getArticleOutput(article_id);
|
|
@@ -1784,15 +1837,16 @@ var ArticleToolHandler = class {
|
|
|
1784
1837
|
inputSchema: {
|
|
1785
1838
|
type: "object",
|
|
1786
1839
|
properties: {
|
|
1787
|
-
|
|
1840
|
+
id: { type: "string", format: "uuid", description: "ID of the article" },
|
|
1788
1841
|
output_id: { type: "string", format: "uuid", description: "ID of the output to update" },
|
|
1789
1842
|
updates: { type: "object", description: "Fields to update in the output" }
|
|
1790
1843
|
},
|
|
1791
|
-
required: ["
|
|
1844
|
+
required: ["id", "output_id", "updates"]
|
|
1792
1845
|
},
|
|
1793
1846
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
1794
1847
|
try {
|
|
1795
|
-
const
|
|
1848
|
+
const article_id = resolveId(args, "article_id");
|
|
1849
|
+
const { output_id, updates } = args;
|
|
1796
1850
|
const result2 = await this.apiClient.updateArticleOutput(article_id, output_id, updates);
|
|
1797
1851
|
await this.cache.delete(`article:output:${article_id}`);
|
|
1798
1852
|
this.metrics.recordAPICall("update_article_output", "success");
|
|
@@ -1947,18 +2001,18 @@ var ProjectToolHandler = class {
|
|
|
1947
2001
|
inputSchema: {
|
|
1948
2002
|
type: "object",
|
|
1949
2003
|
properties: {
|
|
1950
|
-
|
|
2004
|
+
id: {
|
|
1951
2005
|
type: "string",
|
|
1952
2006
|
format: "uuid",
|
|
1953
2007
|
description: "Project ID"
|
|
1954
2008
|
}
|
|
1955
2009
|
},
|
|
1956
|
-
required: ["
|
|
2010
|
+
required: ["id"]
|
|
1957
2011
|
},
|
|
1958
2012
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
1959
2013
|
try {
|
|
1960
|
-
const
|
|
1961
|
-
const cached = await this.cache.get(`project:${
|
|
2014
|
+
const id = resolveId(args, "project_id");
|
|
2015
|
+
const cached = await this.cache.get(`project:${id}`);
|
|
1962
2016
|
if (cached) {
|
|
1963
2017
|
return {
|
|
1964
2018
|
content: [
|
|
@@ -1973,8 +2027,8 @@ var ProjectToolHandler = class {
|
|
|
1973
2027
|
]
|
|
1974
2028
|
};
|
|
1975
2029
|
}
|
|
1976
|
-
const project = await this.apiClient.getProject(
|
|
1977
|
-
await this.cache.set(`project:${
|
|
2030
|
+
const project = await this.apiClient.getProject(id);
|
|
2031
|
+
await this.cache.set(`project:${id}`, project, 600);
|
|
1978
2032
|
this.metrics.recordAPICall("get_project", "success");
|
|
1979
2033
|
return {
|
|
1980
2034
|
content: [
|
|
@@ -2042,12 +2096,7 @@ var ProjectToolHandler = class {
|
|
|
2042
2096
|
success: true,
|
|
2043
2097
|
total: result2.total,
|
|
2044
2098
|
count: result2.items.length,
|
|
2045
|
-
projects: result2.items
|
|
2046
|
-
id: p.id,
|
|
2047
|
-
name: p.name,
|
|
2048
|
-
website_url: p.website_url,
|
|
2049
|
-
created_at: p.created_at
|
|
2050
|
-
}))
|
|
2099
|
+
projects: result2.items
|
|
2051
2100
|
}, null, 2)
|
|
2052
2101
|
}
|
|
2053
2102
|
]
|
|
@@ -2078,7 +2127,7 @@ var ProjectToolHandler = class {
|
|
|
2078
2127
|
inputSchema: {
|
|
2079
2128
|
type: "object",
|
|
2080
2129
|
properties: {
|
|
2081
|
-
|
|
2130
|
+
id: {
|
|
2082
2131
|
type: "string",
|
|
2083
2132
|
format: "uuid",
|
|
2084
2133
|
description: "Project ID"
|
|
@@ -2095,13 +2144,14 @@ var ProjectToolHandler = class {
|
|
|
2095
2144
|
}
|
|
2096
2145
|
}
|
|
2097
2146
|
},
|
|
2098
|
-
required: ["
|
|
2147
|
+
required: ["id", "updates"]
|
|
2099
2148
|
},
|
|
2100
2149
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
2101
2150
|
try {
|
|
2102
|
-
const
|
|
2103
|
-
|
|
2104
|
-
await this.
|
|
2151
|
+
const id = resolveId(args, "project_id");
|
|
2152
|
+
const { updates } = args;
|
|
2153
|
+
await this.apiClient.updateProject(id, updates);
|
|
2154
|
+
await this.cache.delete(`project:${id}`);
|
|
2105
2155
|
this.metrics.recordAPICall("update_project", "success");
|
|
2106
2156
|
return {
|
|
2107
2157
|
content: [
|
|
@@ -2110,7 +2160,7 @@ var ProjectToolHandler = class {
|
|
|
2110
2160
|
text: JSON.stringify({
|
|
2111
2161
|
success: true,
|
|
2112
2162
|
message: "Project updated successfully",
|
|
2113
|
-
project_id,
|
|
2163
|
+
project_id: id,
|
|
2114
2164
|
updated_fields: Object.keys(updates)
|
|
2115
2165
|
}, null, 2)
|
|
2116
2166
|
}
|
|
@@ -2142,7 +2192,7 @@ var ProjectToolHandler = class {
|
|
|
2142
2192
|
inputSchema: {
|
|
2143
2193
|
type: "object",
|
|
2144
2194
|
properties: {
|
|
2145
|
-
|
|
2195
|
+
id: {
|
|
2146
2196
|
type: "string",
|
|
2147
2197
|
format: "uuid",
|
|
2148
2198
|
description: "Project ID to delete"
|
|
@@ -2153,11 +2203,12 @@ var ProjectToolHandler = class {
|
|
|
2153
2203
|
const: true
|
|
2154
2204
|
}
|
|
2155
2205
|
},
|
|
2156
|
-
required: ["
|
|
2206
|
+
required: ["id", "confirm"]
|
|
2157
2207
|
},
|
|
2158
2208
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
2159
2209
|
try {
|
|
2160
|
-
const
|
|
2210
|
+
const id = resolveId(args, "project_id");
|
|
2211
|
+
const { confirm } = args;
|
|
2161
2212
|
if (!confirm) {
|
|
2162
2213
|
return {
|
|
2163
2214
|
content: [
|
|
@@ -2172,8 +2223,8 @@ var ProjectToolHandler = class {
|
|
|
2172
2223
|
isError: true
|
|
2173
2224
|
};
|
|
2174
2225
|
}
|
|
2175
|
-
await this.apiClient.deleteProject(
|
|
2176
|
-
await this.cache.delete(`project:${
|
|
2226
|
+
await this.apiClient.deleteProject(id);
|
|
2227
|
+
await this.cache.delete(`project:${id}`);
|
|
2177
2228
|
this.metrics.recordAPICall("delete_project", "success");
|
|
2178
2229
|
return {
|
|
2179
2230
|
content: [
|
|
@@ -2182,7 +2233,7 @@ var ProjectToolHandler = class {
|
|
|
2182
2233
|
text: JSON.stringify({
|
|
2183
2234
|
success: true,
|
|
2184
2235
|
message: "Project deleted successfully",
|
|
2185
|
-
project_id
|
|
2236
|
+
project_id: id
|
|
2186
2237
|
}, null, 2)
|
|
2187
2238
|
}
|
|
2188
2239
|
]
|
|
@@ -2496,18 +2547,18 @@ var PersonaToolHandler = class {
|
|
|
2496
2547
|
inputSchema: {
|
|
2497
2548
|
type: "object",
|
|
2498
2549
|
properties: {
|
|
2499
|
-
|
|
2550
|
+
id: {
|
|
2500
2551
|
type: "string",
|
|
2501
2552
|
format: "uuid",
|
|
2502
2553
|
description: "Persona ID"
|
|
2503
2554
|
}
|
|
2504
2555
|
},
|
|
2505
|
-
required: ["
|
|
2556
|
+
required: ["id"]
|
|
2506
2557
|
},
|
|
2507
2558
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
2508
2559
|
try {
|
|
2509
|
-
const
|
|
2510
|
-
const cached = await this.cache.get(`persona:${
|
|
2560
|
+
const id = resolveId(args, "persona_id");
|
|
2561
|
+
const cached = await this.cache.get(`persona:${id}`);
|
|
2511
2562
|
if (cached) {
|
|
2512
2563
|
return {
|
|
2513
2564
|
content: [
|
|
@@ -2522,8 +2573,8 @@ var PersonaToolHandler = class {
|
|
|
2522
2573
|
]
|
|
2523
2574
|
};
|
|
2524
2575
|
}
|
|
2525
|
-
const persona = await this.apiClient.getPersona(
|
|
2526
|
-
await this.cache.set(`persona:${
|
|
2576
|
+
const persona = await this.apiClient.getPersona(id);
|
|
2577
|
+
await this.cache.set(`persona:${id}`, persona, 600);
|
|
2527
2578
|
this.metrics.recordAPICall("get_persona", "success");
|
|
2528
2579
|
return {
|
|
2529
2580
|
content: [
|
|
@@ -2628,7 +2679,7 @@ var PersonaToolHandler = class {
|
|
|
2628
2679
|
inputSchema: {
|
|
2629
2680
|
type: "object",
|
|
2630
2681
|
properties: {
|
|
2631
|
-
|
|
2682
|
+
id: {
|
|
2632
2683
|
type: "string",
|
|
2633
2684
|
format: "uuid",
|
|
2634
2685
|
description: "Persona ID"
|
|
@@ -2649,13 +2700,14 @@ var PersonaToolHandler = class {
|
|
|
2649
2700
|
}
|
|
2650
2701
|
}
|
|
2651
2702
|
},
|
|
2652
|
-
required: ["
|
|
2703
|
+
required: ["id", "updates"]
|
|
2653
2704
|
},
|
|
2654
2705
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
2655
2706
|
try {
|
|
2656
|
-
const
|
|
2657
|
-
|
|
2658
|
-
await this.
|
|
2707
|
+
const id = resolveId(args, "persona_id");
|
|
2708
|
+
const { updates } = args;
|
|
2709
|
+
await this.apiClient.updatePersona(id, updates);
|
|
2710
|
+
await this.cache.delete(`persona:${id}`);
|
|
2659
2711
|
this.metrics.recordAPICall("update_persona", "success");
|
|
2660
2712
|
return {
|
|
2661
2713
|
content: [
|
|
@@ -2664,7 +2716,7 @@ var PersonaToolHandler = class {
|
|
|
2664
2716
|
text: JSON.stringify({
|
|
2665
2717
|
success: true,
|
|
2666
2718
|
message: "Persona updated successfully",
|
|
2667
|
-
persona_id,
|
|
2719
|
+
persona_id: id,
|
|
2668
2720
|
updated_fields: Object.keys(updates)
|
|
2669
2721
|
}, null, 2)
|
|
2670
2722
|
}
|
|
@@ -2696,7 +2748,7 @@ var PersonaToolHandler = class {
|
|
|
2696
2748
|
inputSchema: {
|
|
2697
2749
|
type: "object",
|
|
2698
2750
|
properties: {
|
|
2699
|
-
|
|
2751
|
+
id: {
|
|
2700
2752
|
type: "string",
|
|
2701
2753
|
format: "uuid",
|
|
2702
2754
|
description: "Persona ID to delete"
|
|
@@ -2707,11 +2759,12 @@ var PersonaToolHandler = class {
|
|
|
2707
2759
|
const: true
|
|
2708
2760
|
}
|
|
2709
2761
|
},
|
|
2710
|
-
required: ["
|
|
2762
|
+
required: ["id", "confirm"]
|
|
2711
2763
|
},
|
|
2712
2764
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
2713
2765
|
try {
|
|
2714
|
-
const
|
|
2766
|
+
const id = resolveId(args, "persona_id");
|
|
2767
|
+
const { confirm } = args;
|
|
2715
2768
|
if (!confirm) {
|
|
2716
2769
|
return {
|
|
2717
2770
|
content: [
|
|
@@ -2726,8 +2779,8 @@ var PersonaToolHandler = class {
|
|
|
2726
2779
|
isError: true
|
|
2727
2780
|
};
|
|
2728
2781
|
}
|
|
2729
|
-
await this.apiClient.deletePersona(
|
|
2730
|
-
await this.cache.delete(`persona:${
|
|
2782
|
+
await this.apiClient.deletePersona(id);
|
|
2783
|
+
await this.cache.delete(`persona:${id}`);
|
|
2731
2784
|
this.metrics.recordAPICall("delete_persona", "success");
|
|
2732
2785
|
return {
|
|
2733
2786
|
content: [
|
|
@@ -2736,7 +2789,7 @@ var PersonaToolHandler = class {
|
|
|
2736
2789
|
text: JSON.stringify({
|
|
2737
2790
|
success: true,
|
|
2738
2791
|
message: "Persona deleted successfully",
|
|
2739
|
-
persona_id
|
|
2792
|
+
persona_id: id
|
|
2740
2793
|
}, null, 2)
|
|
2741
2794
|
}
|
|
2742
2795
|
]
|
|
@@ -3093,18 +3146,18 @@ var ConnectionsToolHandler = class {
|
|
|
3093
3146
|
inputSchema: {
|
|
3094
3147
|
type: "object",
|
|
3095
3148
|
properties: {
|
|
3096
|
-
|
|
3149
|
+
id: {
|
|
3097
3150
|
type: "string",
|
|
3098
3151
|
format: "uuid",
|
|
3099
3152
|
description: "Connection ID"
|
|
3100
3153
|
}
|
|
3101
3154
|
},
|
|
3102
|
-
required: ["
|
|
3155
|
+
required: ["id"]
|
|
3103
3156
|
},
|
|
3104
3157
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
3105
3158
|
try {
|
|
3106
|
-
const
|
|
3107
|
-
const cached = await this.cache.get(`connection:${
|
|
3159
|
+
const id = resolveId(args, "connection_id");
|
|
3160
|
+
const cached = await this.cache.get(`connection:${id}`);
|
|
3108
3161
|
if (cached) {
|
|
3109
3162
|
return {
|
|
3110
3163
|
content: [
|
|
@@ -3119,8 +3172,8 @@ var ConnectionsToolHandler = class {
|
|
|
3119
3172
|
]
|
|
3120
3173
|
};
|
|
3121
3174
|
}
|
|
3122
|
-
const connection = await this.apiClient.getConnection(
|
|
3123
|
-
await this.cache.set(`connection:${
|
|
3175
|
+
const connection = await this.apiClient.getConnection(id);
|
|
3176
|
+
await this.cache.set(`connection:${id}`, connection, 600);
|
|
3124
3177
|
this.metrics.recordAPICall("get_connection", "success");
|
|
3125
3178
|
return {
|
|
3126
3179
|
content: [
|
|
@@ -3223,7 +3276,7 @@ var ConnectionsToolHandler = class {
|
|
|
3223
3276
|
inputSchema: {
|
|
3224
3277
|
type: "object",
|
|
3225
3278
|
properties: {
|
|
3226
|
-
|
|
3279
|
+
id: {
|
|
3227
3280
|
type: "string",
|
|
3228
3281
|
format: "uuid",
|
|
3229
3282
|
description: "Connection ID"
|
|
@@ -3236,13 +3289,14 @@ var ConnectionsToolHandler = class {
|
|
|
3236
3289
|
}
|
|
3237
3290
|
}
|
|
3238
3291
|
},
|
|
3239
|
-
required: ["
|
|
3292
|
+
required: ["id", "updates"]
|
|
3240
3293
|
},
|
|
3241
3294
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
3242
3295
|
try {
|
|
3243
|
-
const
|
|
3244
|
-
|
|
3245
|
-
await this.
|
|
3296
|
+
const id = resolveId(args, "connection_id");
|
|
3297
|
+
const { updates } = args;
|
|
3298
|
+
await this.apiClient.updateConnection(id, updates);
|
|
3299
|
+
await this.cache.delete(`connection:${id}`);
|
|
3246
3300
|
this.metrics.recordAPICall("update_connection", "success");
|
|
3247
3301
|
return {
|
|
3248
3302
|
content: [
|
|
@@ -3251,7 +3305,7 @@ var ConnectionsToolHandler = class {
|
|
|
3251
3305
|
text: JSON.stringify({
|
|
3252
3306
|
success: true,
|
|
3253
3307
|
message: "Connection updated successfully",
|
|
3254
|
-
connection_id
|
|
3308
|
+
connection_id: id
|
|
3255
3309
|
}, null, 2)
|
|
3256
3310
|
}
|
|
3257
3311
|
]
|
|
@@ -3282,7 +3336,7 @@ var ConnectionsToolHandler = class {
|
|
|
3282
3336
|
inputSchema: {
|
|
3283
3337
|
type: "object",
|
|
3284
3338
|
properties: {
|
|
3285
|
-
|
|
3339
|
+
id: {
|
|
3286
3340
|
type: "string",
|
|
3287
3341
|
format: "uuid",
|
|
3288
3342
|
description: "Connection ID to delete"
|
|
@@ -3293,11 +3347,12 @@ var ConnectionsToolHandler = class {
|
|
|
3293
3347
|
const: true
|
|
3294
3348
|
}
|
|
3295
3349
|
},
|
|
3296
|
-
required: ["
|
|
3350
|
+
required: ["id", "confirm"]
|
|
3297
3351
|
},
|
|
3298
3352
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
3299
3353
|
try {
|
|
3300
|
-
const
|
|
3354
|
+
const id = resolveId(args, "connection_id");
|
|
3355
|
+
const { confirm } = args;
|
|
3301
3356
|
if (!confirm) {
|
|
3302
3357
|
return {
|
|
3303
3358
|
content: [
|
|
@@ -3312,8 +3367,8 @@ var ConnectionsToolHandler = class {
|
|
|
3312
3367
|
isError: true
|
|
3313
3368
|
};
|
|
3314
3369
|
}
|
|
3315
|
-
await this.apiClient.deleteConnection(
|
|
3316
|
-
await this.cache.delete(`connection:${
|
|
3370
|
+
await this.apiClient.deleteConnection(id);
|
|
3371
|
+
await this.cache.delete(`connection:${id}`);
|
|
3317
3372
|
this.metrics.recordAPICall("delete_connection", "success");
|
|
3318
3373
|
return {
|
|
3319
3374
|
content: [
|
|
@@ -3322,7 +3377,7 @@ var ConnectionsToolHandler = class {
|
|
|
3322
3377
|
text: JSON.stringify({
|
|
3323
3378
|
success: true,
|
|
3324
3379
|
message: "Connection deleted successfully",
|
|
3325
|
-
connection_id
|
|
3380
|
+
connection_id: id
|
|
3326
3381
|
}, null, 2)
|
|
3327
3382
|
}
|
|
3328
3383
|
]
|
|
@@ -3636,7 +3691,7 @@ var CategoryPagesToolHandler = class {
|
|
|
3636
3691
|
inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid", description: "ID of the category page" } }, required: ["id"] },
|
|
3637
3692
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
3638
3693
|
try {
|
|
3639
|
-
const
|
|
3694
|
+
const id = resolveId(args);
|
|
3640
3695
|
const cached = await this.cache.get(`category_page:${id}`);
|
|
3641
3696
|
if (cached) {
|
|
3642
3697
|
return { content: [{ type: "text", text: JSON.stringify({ success: true, category_page: cached, from_cache: true }, null, 2) }] };
|
|
@@ -3696,7 +3751,8 @@ var CategoryPagesToolHandler = class {
|
|
|
3696
3751
|
},
|
|
3697
3752
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
3698
3753
|
try {
|
|
3699
|
-
const
|
|
3754
|
+
const id = resolveId(args);
|
|
3755
|
+
const { updates } = args;
|
|
3700
3756
|
await this.apiClient.updateCategoryPage(id, updates);
|
|
3701
3757
|
await this.cache.delete(`category_page:${id}`);
|
|
3702
3758
|
this.metrics.recordAPICall("update_category_page", "success");
|
|
@@ -3724,7 +3780,8 @@ var CategoryPagesToolHandler = class {
|
|
|
3724
3780
|
},
|
|
3725
3781
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
3726
3782
|
try {
|
|
3727
|
-
const
|
|
3783
|
+
const id = resolveId(args);
|
|
3784
|
+
const { wait_for_completion = true, max_wait_time = 300 } = args;
|
|
3728
3785
|
await this.apiClient.runCategoryPageGeneration(id);
|
|
3729
3786
|
if (!wait_for_completion) {
|
|
3730
3787
|
return { content: [{ type: "text", text: JSON.stringify({ success: true, message: "Category page generation started", category_page_id: id }, null, 2) }] };
|
|
@@ -3760,7 +3817,7 @@ var CategoryPagesToolHandler = class {
|
|
|
3760
3817
|
inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid", description: "ID of the category page" } }, required: ["id"] },
|
|
3761
3818
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
3762
3819
|
try {
|
|
3763
|
-
const
|
|
3820
|
+
const id = resolveId(args);
|
|
3764
3821
|
const cacheKey = `category_page:output:${id}`;
|
|
3765
3822
|
const cached = await this.cache.get(cacheKey);
|
|
3766
3823
|
const output = cached || await this.apiClient.getCategoryPageOutput(id);
|
|
@@ -3948,7 +4005,7 @@ var ProductPagesToolHandler = class {
|
|
|
3948
4005
|
inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid", description: "ID of the product page" } }, required: ["id"] },
|
|
3949
4006
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
3950
4007
|
try {
|
|
3951
|
-
const
|
|
4008
|
+
const id = resolveId(args);
|
|
3952
4009
|
const cached = await this.cache.get(`product_page:${id}`);
|
|
3953
4010
|
if (cached) {
|
|
3954
4011
|
return { content: [{ type: "text", text: JSON.stringify({ success: true, product_page: cached, from_cache: true }, null, 2) }] };
|
|
@@ -3999,7 +4056,8 @@ var ProductPagesToolHandler = class {
|
|
|
3999
4056
|
inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid", description: "ID of the product page to update" }, updates: { type: "object", description: "Fields to update" } }, required: ["id", "updates"] },
|
|
4000
4057
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4001
4058
|
try {
|
|
4002
|
-
const
|
|
4059
|
+
const id = resolveId(args);
|
|
4060
|
+
const { updates } = args;
|
|
4003
4061
|
await this.apiClient.updateProductPage(id, updates);
|
|
4004
4062
|
await this.cache.delete(`product_page:${id}`);
|
|
4005
4063
|
this.metrics.recordAPICall("update_product_page", "success");
|
|
@@ -4019,7 +4077,8 @@ var ProductPagesToolHandler = class {
|
|
|
4019
4077
|
inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid" }, wait_for_completion: { type: "boolean", default: true }, max_wait_time: { type: "number", default: 300, maximum: 600 } }, required: ["id"] },
|
|
4020
4078
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4021
4079
|
try {
|
|
4022
|
-
const
|
|
4080
|
+
const id = resolveId(args);
|
|
4081
|
+
const { wait_for_completion = true, max_wait_time = 300 } = args;
|
|
4023
4082
|
await this.apiClient.runProductPageGeneration(id);
|
|
4024
4083
|
if (!wait_for_completion) {
|
|
4025
4084
|
return { content: [{ type: "text", text: JSON.stringify({ success: true, message: "Product page generation started", product_page_id: id }, null, 2) }] };
|
|
@@ -4055,7 +4114,7 @@ var ProductPagesToolHandler = class {
|
|
|
4055
4114
|
inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid" } }, required: ["id"] },
|
|
4056
4115
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4057
4116
|
try {
|
|
4058
|
-
const
|
|
4117
|
+
const id = resolveId(args);
|
|
4059
4118
|
const cacheKey = `product_page:output:${id}`;
|
|
4060
4119
|
const cached = await this.cache.get(cacheKey);
|
|
4061
4120
|
const output = cached || await this.apiClient.getProductPageOutput(id);
|
|
@@ -4335,7 +4394,7 @@ var DiscoverToolHandler = class {
|
|
|
4335
4394
|
inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid" } }, required: ["id"] },
|
|
4336
4395
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4337
4396
|
try {
|
|
4338
|
-
const
|
|
4397
|
+
const id = resolveId(args);
|
|
4339
4398
|
const cached = await this.cache.get(`discover:${id}`);
|
|
4340
4399
|
if (cached) {
|
|
4341
4400
|
return { content: [{ type: "text", text: JSON.stringify({ success: true, discovery: cached, from_cache: true }, null, 2) }] };
|
|
@@ -4386,7 +4445,8 @@ var DiscoverToolHandler = class {
|
|
|
4386
4445
|
inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid" }, updates: { type: "object", description: "Fields to update" } }, required: ["id", "updates"] },
|
|
4387
4446
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4388
4447
|
try {
|
|
4389
|
-
const
|
|
4448
|
+
const id = resolveId(args);
|
|
4449
|
+
const { updates } = args;
|
|
4390
4450
|
await this.apiClient.updateDiscoverArticle(id, updates);
|
|
4391
4451
|
await this.cache.delete(`discover:${id}`);
|
|
4392
4452
|
this.metrics.recordAPICall("update_discover_article", "success");
|
|
@@ -4406,7 +4466,7 @@ var DiscoverToolHandler = class {
|
|
|
4406
4466
|
inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid" } }, required: ["id"] },
|
|
4407
4467
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4408
4468
|
try {
|
|
4409
|
-
const
|
|
4469
|
+
const id = resolveId(args);
|
|
4410
4470
|
await this.apiClient.runDiscovery(id);
|
|
4411
4471
|
await this.cache.delete(`discover:${id}`);
|
|
4412
4472
|
this.metrics.recordAPICall("run_discovery", "success");
|
|
@@ -4426,7 +4486,7 @@ var DiscoverToolHandler = class {
|
|
|
4426
4486
|
inputSchema: { type: "object", properties: { id: { type: "string", format: "uuid" } }, required: ["id"] },
|
|
4427
4487
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4428
4488
|
try {
|
|
4429
|
-
const
|
|
4489
|
+
const id = resolveId(args);
|
|
4430
4490
|
const cacheKey = `discover:output:${id}`;
|
|
4431
4491
|
const cached = await this.cache.get(cacheKey);
|
|
4432
4492
|
const output = cached || await this.apiClient.getDiscoverArticleOutput(id);
|
|
@@ -4582,7 +4642,7 @@ var RSSToolHandler = class {
|
|
|
4582
4642
|
},
|
|
4583
4643
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4584
4644
|
try {
|
|
4585
|
-
const
|
|
4645
|
+
const id = resolveId(args);
|
|
4586
4646
|
const cached = await this.cache.get(`feed:${id}`);
|
|
4587
4647
|
if (cached) {
|
|
4588
4648
|
return { content: [{ type: "text", text: JSON.stringify({ success: true, feed: cached, from_cache: true }, null, 2) }] };
|
|
@@ -4672,7 +4732,8 @@ var RSSToolHandler = class {
|
|
|
4672
4732
|
},
|
|
4673
4733
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4674
4734
|
try {
|
|
4675
|
-
const
|
|
4735
|
+
const id = resolveId(args);
|
|
4736
|
+
const { updates } = args;
|
|
4676
4737
|
await this.apiClient.updateFeed(id, updates);
|
|
4677
4738
|
await this.cache.delete(`feed:${id}`);
|
|
4678
4739
|
this.metrics.recordAPICall("update_feed", "success");
|
|
@@ -4698,7 +4759,7 @@ var RSSToolHandler = class {
|
|
|
4698
4759
|
},
|
|
4699
4760
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4700
4761
|
try {
|
|
4701
|
-
const
|
|
4762
|
+
const id = resolveId(args);
|
|
4702
4763
|
await this.apiClient.deleteFeed(id);
|
|
4703
4764
|
await this.cache.delete(`feed:${id}`);
|
|
4704
4765
|
this.metrics.recordAPICall("delete_feed", "success");
|
|
@@ -4820,7 +4881,7 @@ var JobsToolHandler = class {
|
|
|
4820
4881
|
},
|
|
4821
4882
|
handler: /* @__PURE__ */ __name(async (args) => {
|
|
4822
4883
|
try {
|
|
4823
|
-
const
|
|
4884
|
+
const id = resolveId(args);
|
|
4824
4885
|
const job = await this.apiClient.getJob(id);
|
|
4825
4886
|
this.metrics.recordAPICall("get_job", "success");
|
|
4826
4887
|
return {
|