it-tools-mcp 3.0.23 → 3.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/README.dockerhub.md +30 -17
- package/README.md +81 -33
- package/build/index.js +47 -15
- package/build/tools/ansible/ansible-inventory-generator/index.js +212 -0
- package/build/tools/ansible/ansible-playbook-validator/index.js +128 -0
- package/build/tools/ansible/ansible-reference/index.js +393 -0
- package/build/tools/ansible/ansible-vault-decrypt/index.js +137 -0
- package/build/tools/ansible/ansible-vault-encrypt/index.js +79 -0
- package/build/tools/color/color-hex-to-rgb/index.js +29 -0
- package/build/tools/{color.js → color/color-rgb-to-hex/index.js} +1 -27
- package/build/tools/crypto/basic-auth-generator/index.js +45 -0
- package/build/tools/crypto/bcrypt-hash/index.js +67 -0
- package/build/tools/crypto/bip39-generate/index.js +53 -0
- package/build/tools/crypto/hash-md5/index.js +19 -0
- package/build/tools/crypto/hash-sha1/index.js +19 -0
- package/build/tools/crypto/hash-sha256/index.js +19 -0
- package/build/tools/crypto/hash-sha512/index.js +19 -0
- package/build/tools/crypto/hmac-generator/index.js +37 -0
- package/build/tools/crypto/jwt-decode/index.js +41 -0
- package/build/tools/crypto/otp-code-generator/index.js +67 -0
- package/build/tools/crypto/password-generate/index.js +54 -0
- package/build/tools/crypto/token-generator/index.js +75 -0
- package/build/tools/dataFormat/html-to-markdown/index.js +34 -0
- package/build/tools/dataFormat/json-diff/index.js +94 -0
- package/build/tools/dataFormat/json-format/index.js +100 -0
- package/build/tools/dataFormat/json-minify/index.js +29 -0
- package/build/tools/dataFormat/json-to-csv/index.js +34 -0
- package/build/tools/dataFormat/json-to-toml/index.js +30 -0
- package/build/tools/dataFormat/markdown-to-html/index.js +32 -0
- package/build/tools/dataFormat/phone-format/index.js +35 -0
- package/build/tools/dataFormat/sql-format/index.js +37 -0
- package/build/tools/dataFormat/toml-to-json/index.js +29 -0
- package/build/tools/dataFormat/xml-format/index.js +44 -0
- package/build/tools/dataFormat/yaml-format/index.js +58 -0
- package/build/tools/{development.js → development/crontab-generate/index.js} +1 -129
- package/build/tools/development/html-prettifier/index.js +47 -0
- package/build/tools/development/javascript-prettifier/index.js +74 -0
- package/build/tools/development/list-converter/index.js +62 -0
- package/build/tools/development/markdown-toc-generator/index.js +53 -0
- package/build/tools/development/regex-tester/index.js +69 -0
- package/build/tools/docker/docker-compose-to-docker-run/index.js +138 -0
- package/build/tools/docker/docker-compose-validator/index.js +125 -0
- package/build/tools/docker/docker-reference/index.js +188 -0
- package/build/tools/docker/docker-run-to-docker-compose/index.js +117 -0
- package/build/tools/docker/traefik-compose-generator/index.js +98 -0
- package/build/tools/encoding/base64-decode/index.js +28 -0
- package/build/tools/encoding/base64-encode/index.js +16 -0
- package/build/tools/encoding/html-decode/index.js +21 -0
- package/build/tools/encoding/html-encode/index.js +21 -0
- package/build/tools/encoding/html-entities-extended/index.js +72 -0
- package/build/tools/encoding/text-to-binary/index.js +51 -0
- package/build/tools/encoding/url-decode/index.js +28 -0
- package/build/tools/encoding/url-encode/index.js +16 -0
- package/build/tools/forensic/file-type-identifier/index.js +90 -0
- package/build/tools/forensic/safelink-decoder/index.js +54 -0
- package/build/tools/forensic/url-fanger/index.js +52 -0
- package/build/tools/idGenerators/qr-generate/index.js +76 -0
- package/build/tools/idGenerators/svg-placeholder-generator/index.js +59 -0
- package/build/tools/idGenerators/ulid-generate/index.js +34 -0
- package/build/tools/idGenerators/uuid-generate/index.js +14 -0
- package/build/tools/math/math-evaluate/index.js +33 -0
- package/build/tools/math/number-base-converter/index.js +46 -0
- package/build/tools/math/percentage-calculator/index.js +50 -0
- package/build/tools/math/roman-numeral-converter/index.js +76 -0
- package/build/tools/math/temperature-converter/index.js +59 -0
- package/build/tools/math/unix-timestamp-converter/index.js +55 -0
- package/build/tools/network/cat/index.js +15 -0
- package/build/tools/network/cidr-to-ip-range/index.js +108 -0
- package/build/tools/network/curl/index.js +35 -0
- package/build/tools/network/dig/index.js +19 -0
- package/build/tools/network/grep/index.js +18 -0
- package/build/tools/network/head/index.js +17 -0
- package/build/tools/network/iban-validate/index.js +83 -0
- package/build/tools/network/ip-range-to-cidr/index.js +88 -0
- package/build/tools/network/ip-subnet-calculator/index.js +102 -0
- package/build/tools/network/ipv4-subnet-calc/index.js +112 -0
- package/build/tools/network/ipv6-subnet-calculator/index.js +104 -0
- package/build/tools/network/ipv6-ula-generator/index.js +65 -0
- package/build/tools/network/mac-address-generate/index.js +68 -0
- package/build/tools/network/nslookup/index.js +18 -0
- package/build/tools/network/ping/index.js +20 -0
- package/build/tools/network/ps/index.js +22 -0
- package/build/tools/network/random-port/index.js +53 -0
- package/build/tools/network/scp/index.js +134 -0
- package/build/tools/network/ssh/index.js +83 -0
- package/build/tools/network/tail/index.js +16 -0
- package/build/tools/network/telnet/index.js +45 -0
- package/build/tools/network/top/index.js +14 -0
- package/build/tools/network/url-parse/index.js +52 -0
- package/build/tools/physics/angle-converter/index.js +73 -0
- package/build/tools/physics/energy-converter/index.js +72 -0
- package/build/tools/physics/power-converter/index.js +71 -0
- package/build/tools/text/ascii-art-text/index.js +112 -0
- package/build/tools/text/distinct-words/index.js +30 -0
- package/build/tools/text/emoji-search/index.js +76 -0
- package/build/tools/text/lorem-ipsum-generator/index.js +87 -0
- package/build/tools/text/numeronym-generator/index.js +37 -0
- package/build/tools/text/slugify-string/index.js +44 -0
- package/build/tools/text/string-obfuscator/index.js +49 -0
- package/build/tools/text/text-camelcase/index.js +20 -0
- package/build/tools/text/text-capitalize/index.js +16 -0
- package/build/tools/text/text-diff/index.js +72 -0
- package/build/tools/text/text-kebabcase/index.js +20 -0
- package/build/tools/text/text-lowercase/index.js +15 -0
- package/build/tools/text/text-pascalcase/index.js +18 -0
- package/build/tools/text/text-snakecase/index.js +20 -0
- package/build/tools/text/text-stats/index.js +29 -0
- package/build/tools/text/text-to-nato-alphabet/index.js +57 -0
- package/build/tools/text/text-to-unicode/index.js +50 -0
- package/build/tools/text/text-to-unicode-names/index.js +34 -0
- package/build/tools/text/text-uppercase/index.js +15 -0
- package/build/tools/utility/css-prettifier/index.js +70 -0
- package/build/tools/utility/device-info/index.js +44 -0
- package/build/tools/utility/email-normalizer/index.js +73 -0
- package/build/tools/utility/http-status-codes/index.js +173 -0
- package/build/tools/utility/mime-types/index.js +121 -0
- package/build/tools/utility/port-numbers/index.js +106 -0
- package/build/tools/utility/rem-px-converter/index.js +63 -0
- package/package.json +3 -3
- package/build/tools/crypto.js +0 -445
- package/build/tools/dataFormat.js +0 -535
- package/build/tools/encoding.js +0 -240
- package/build/tools/idGenerators.js +0 -180
- package/build/tools/math.js +0 -310
- package/build/tools/network.js +0 -931
- package/build/tools/text.js +0 -678
- package/build/tools/utility.js +0 -407
package/build/tools/encoding.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export function registerEncodingTools(server) {
|
|
3
|
-
// Base64 encoding tool
|
|
4
|
-
server.tool("base64-encode", "Encode text to Base64", {
|
|
5
|
-
text: z.string().describe("Text to encode to Base64"),
|
|
6
|
-
}, async ({ text }) => {
|
|
7
|
-
const encoded = Buffer.from(text, 'utf-8').toString('base64');
|
|
8
|
-
return {
|
|
9
|
-
content: [
|
|
10
|
-
{
|
|
11
|
-
type: "text",
|
|
12
|
-
text: `Base64 encoded: ${encoded}`,
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
// Base64 decoding tool
|
|
18
|
-
server.tool("base64-decode", "Decode Base64 text", {
|
|
19
|
-
text: z.string().describe("Base64 text to decode"),
|
|
20
|
-
}, async ({ text }) => {
|
|
21
|
-
try {
|
|
22
|
-
const decoded = Buffer.from(text, 'base64').toString('utf-8');
|
|
23
|
-
return {
|
|
24
|
-
content: [
|
|
25
|
-
{
|
|
26
|
-
type: "text",
|
|
27
|
-
text: `Base64 decoded: ${decoded}`,
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
return {
|
|
34
|
-
content: [
|
|
35
|
-
{
|
|
36
|
-
type: "text",
|
|
37
|
-
text: `Error decoding Base64: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
// URL encoding tool
|
|
44
|
-
server.tool("url-encode", "URL encode text", {
|
|
45
|
-
text: z.string().describe("Text to URL encode"),
|
|
46
|
-
}, async ({ text }) => {
|
|
47
|
-
const encoded = encodeURIComponent(text);
|
|
48
|
-
return {
|
|
49
|
-
content: [
|
|
50
|
-
{
|
|
51
|
-
type: "text",
|
|
52
|
-
text: `URL encoded: ${encoded}`,
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
};
|
|
56
|
-
});
|
|
57
|
-
// URL decoding tool
|
|
58
|
-
server.tool("url-decode", "URL decode text", {
|
|
59
|
-
text: z.string().describe("URL encoded text to decode"),
|
|
60
|
-
}, async ({ text }) => {
|
|
61
|
-
try {
|
|
62
|
-
const decoded = decodeURIComponent(text);
|
|
63
|
-
return {
|
|
64
|
-
content: [
|
|
65
|
-
{
|
|
66
|
-
type: "text",
|
|
67
|
-
text: `URL decoded: ${decoded}`,
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
return {
|
|
74
|
-
content: [
|
|
75
|
-
{
|
|
76
|
-
type: "text",
|
|
77
|
-
text: `Error decoding URL: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
// HTML encode tool
|
|
84
|
-
server.tool("html-encode", "Encode HTML entities", {
|
|
85
|
-
text: z.string().describe("Text to HTML encode"),
|
|
86
|
-
}, async ({ text }) => {
|
|
87
|
-
const encoded = text
|
|
88
|
-
.replace(/&/g, '&')
|
|
89
|
-
.replace(/</g, '<')
|
|
90
|
-
.replace(/>/g, '>')
|
|
91
|
-
.replace(/"/g, '"')
|
|
92
|
-
.replace(/'/g, ''');
|
|
93
|
-
return {
|
|
94
|
-
content: [
|
|
95
|
-
{
|
|
96
|
-
type: "text",
|
|
97
|
-
text: `HTML encoded: ${encoded}`,
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
};
|
|
101
|
-
});
|
|
102
|
-
// HTML decode tool
|
|
103
|
-
server.tool("html-decode", "Decode HTML entities", {
|
|
104
|
-
text: z.string().describe("HTML encoded text to decode"),
|
|
105
|
-
}, async ({ text }) => {
|
|
106
|
-
const decoded = text
|
|
107
|
-
.replace(/&/g, '&')
|
|
108
|
-
.replace(/</g, '<')
|
|
109
|
-
.replace(/>/g, '>')
|
|
110
|
-
.replace(/"/g, '"')
|
|
111
|
-
.replace(/'/g, "'");
|
|
112
|
-
return {
|
|
113
|
-
content: [
|
|
114
|
-
{
|
|
115
|
-
type: "text",
|
|
116
|
-
text: `HTML decoded: ${decoded}`,
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
};
|
|
120
|
-
});
|
|
121
|
-
// Extended HTML entities tool
|
|
122
|
-
server.tool("html-entities-extended", "Extended HTML entity encoding/decoding", {
|
|
123
|
-
text: z.string().describe("Text to encode or decode"),
|
|
124
|
-
operation: z.enum(["encode", "decode"]).describe("Operation to perform"),
|
|
125
|
-
}, async ({ text, operation }) => {
|
|
126
|
-
try {
|
|
127
|
-
if (operation === "encode") {
|
|
128
|
-
const encoded = text
|
|
129
|
-
.replace(/&/g, '&')
|
|
130
|
-
.replace(/</g, '<')
|
|
131
|
-
.replace(/>/g, '>')
|
|
132
|
-
.replace(/"/g, '"')
|
|
133
|
-
.replace(/'/g, ''')
|
|
134
|
-
.replace(/©/g, '©')
|
|
135
|
-
.replace(/®/g, '®')
|
|
136
|
-
.replace(/™/g, '™')
|
|
137
|
-
.replace(/€/g, '€')
|
|
138
|
-
.replace(/£/g, '£')
|
|
139
|
-
.replace(/¥/g, '¥')
|
|
140
|
-
.replace(/§/g, '§')
|
|
141
|
-
.replace(/¶/g, '¶')
|
|
142
|
-
.replace(/†/g, '†')
|
|
143
|
-
.replace(/‡/g, '‡');
|
|
144
|
-
return {
|
|
145
|
-
content: [
|
|
146
|
-
{
|
|
147
|
-
type: "text",
|
|
148
|
-
text: `HTML entities encoded: ${encoded}`,
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
const decoded = text
|
|
155
|
-
.replace(/&/g, '&')
|
|
156
|
-
.replace(/</g, '<')
|
|
157
|
-
.replace(/>/g, '>')
|
|
158
|
-
.replace(/"/g, '"')
|
|
159
|
-
.replace(/'/g, "'")
|
|
160
|
-
.replace(/©/g, '©')
|
|
161
|
-
.replace(/®/g, '®')
|
|
162
|
-
.replace(/™/g, '™')
|
|
163
|
-
.replace(/€/g, '€')
|
|
164
|
-
.replace(/£/g, '£')
|
|
165
|
-
.replace(/¥/g, '¥')
|
|
166
|
-
.replace(/§/g, '§')
|
|
167
|
-
.replace(/¶/g, '¶')
|
|
168
|
-
.replace(/†/g, '†')
|
|
169
|
-
.replace(/‡/g, '‡');
|
|
170
|
-
return {
|
|
171
|
-
content: [
|
|
172
|
-
{
|
|
173
|
-
type: "text",
|
|
174
|
-
text: `HTML entities decoded: ${decoded}`,
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
catch (error) {
|
|
181
|
-
return {
|
|
182
|
-
content: [
|
|
183
|
-
{
|
|
184
|
-
type: "text",
|
|
185
|
-
text: `Error processing HTML entities: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
// Text to binary converter
|
|
192
|
-
server.tool("text-to-binary", "Convert text to binary and vice versa", {
|
|
193
|
-
input: z.string().describe("Text to convert to binary, or binary to convert to text"),
|
|
194
|
-
operation: z.enum(["encode", "decode"]).describe("Operation: encode text to binary or decode binary to text"),
|
|
195
|
-
}, async ({ input, operation }) => {
|
|
196
|
-
try {
|
|
197
|
-
if (operation === "encode") {
|
|
198
|
-
const binary = input
|
|
199
|
-
.split('')
|
|
200
|
-
.map(char => char.charCodeAt(0).toString(2).padStart(8, '0'))
|
|
201
|
-
.join(' ');
|
|
202
|
-
return {
|
|
203
|
-
content: [
|
|
204
|
-
{
|
|
205
|
-
type: "text",
|
|
206
|
-
text: `Text: ${input}
|
|
207
|
-
Binary: ${binary}`,
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
// Decode binary to text
|
|
214
|
-
const binaryGroups = input.replace(/\s+/g, ' ').trim().split(' ');
|
|
215
|
-
const text = binaryGroups
|
|
216
|
-
.map(binary => String.fromCharCode(parseInt(binary, 2)))
|
|
217
|
-
.join('');
|
|
218
|
-
return {
|
|
219
|
-
content: [
|
|
220
|
-
{
|
|
221
|
-
type: "text",
|
|
222
|
-
text: `Binary: ${input}
|
|
223
|
-
Text: ${text}`,
|
|
224
|
-
},
|
|
225
|
-
],
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
catch (error) {
|
|
230
|
-
return {
|
|
231
|
-
content: [
|
|
232
|
-
{
|
|
233
|
-
type: "text",
|
|
234
|
-
text: `Error converting text/binary: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
235
|
-
},
|
|
236
|
-
],
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "crypto";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
export function registerIdGeneratorTools(server) {
|
|
4
|
-
// UUID generation tool
|
|
5
|
-
server.tool("uuid-generate", "Generate a random UUID v4", {}, async () => {
|
|
6
|
-
const uuid = randomUUID();
|
|
7
|
-
return {
|
|
8
|
-
content: [
|
|
9
|
-
{
|
|
10
|
-
type: "text",
|
|
11
|
-
text: `Generated UUID: ${uuid}`,
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
// ULID generator
|
|
17
|
-
server.tool("ulid-generate", "Generate Universally Unique Lexicographically Sortable Identifier", {}, async () => {
|
|
18
|
-
try {
|
|
19
|
-
// Simplified ULID implementation
|
|
20
|
-
const timestamp = Date.now();
|
|
21
|
-
const randomPart = Math.random().toString(36).substring(2, 18);
|
|
22
|
-
const ulid = timestamp.toString(36).toUpperCase() + randomPart.toUpperCase();
|
|
23
|
-
return {
|
|
24
|
-
content: [
|
|
25
|
-
{
|
|
26
|
-
type: "text",
|
|
27
|
-
text: `Generated ULID: ${ulid}
|
|
28
|
-
|
|
29
|
-
Timestamp: ${timestamp}
|
|
30
|
-
Generated at: ${new Date(timestamp).toISOString()}
|
|
31
|
-
|
|
32
|
-
Note: This is a simplified ULID implementation.
|
|
33
|
-
For production use, please use a proper ULID library.`,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
return {
|
|
40
|
-
content: [
|
|
41
|
-
{
|
|
42
|
-
type: "text",
|
|
43
|
-
text: `Error generating ULID: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
// QR code generator (Real implementation using qrcode library)
|
|
50
|
-
server.tool("qr-generate", "Generate QR code for any text including URLs, WiFi networks, contact info, etc.", {
|
|
51
|
-
text: z.string().describe("Text to encode in QR code (URLs, WiFi: WIFI:T:WPA;S:network;P:password;;, contact info, etc.)"),
|
|
52
|
-
size: z.number().describe("Size multiplier (1-3)").optional(),
|
|
53
|
-
}, async ({ text, size = 1 }) => {
|
|
54
|
-
try {
|
|
55
|
-
const QRCode = (await import("qrcode")).default;
|
|
56
|
-
if (size < 1 || size > 3) {
|
|
57
|
-
return {
|
|
58
|
-
content: [
|
|
59
|
-
{
|
|
60
|
-
type: "text",
|
|
61
|
-
text: "Size must be between 1 and 3.",
|
|
62
|
-
},
|
|
63
|
-
],
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
// Generate QR code as base64 data URL
|
|
67
|
-
console.log(`[DEBUG] Generating QR code for: "${text}" with size: ${size}`);
|
|
68
|
-
const dataUrl = await QRCode.toDataURL(text, {
|
|
69
|
-
type: 'image/png',
|
|
70
|
-
errorCorrectionLevel: 'M',
|
|
71
|
-
width: Math.max(256, size * 128), // Minimum 256px, scales with size parameter
|
|
72
|
-
margin: 2,
|
|
73
|
-
color: {
|
|
74
|
-
dark: '#000000', // Black
|
|
75
|
-
light: '#FFFFFF' // White
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
console.log(`[DEBUG] QR code generated successfully`);
|
|
79
|
-
// Extract just the base64 data (remove the data:image/png;base64, prefix)
|
|
80
|
-
const base64Data = dataUrl.split(',')[1];
|
|
81
|
-
const markdown = ``;
|
|
82
|
-
return {
|
|
83
|
-
content: [
|
|
84
|
-
{
|
|
85
|
-
type: "text",
|
|
86
|
-
text: `📱 QR Code for: "${text}"
|
|
87
|
-
\n📊 Data encoded: "${text}" (${text.length} characters)
|
|
88
|
-
🎯 Error correction: Medium (M)
|
|
89
|
-
📐 Image size: ${Math.max(256, size * 128)}x${Math.max(256, size * 128)} pixels
|
|
90
|
-
\n✅ This QR code can be scanned with any QR code reader app
|
|
91
|
-
💡 Generated using the 'qrcode' npm library!
|
|
92
|
-
\n---\n**Markdown for inline display:**\n${markdown}`,
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
type: "image",
|
|
96
|
-
data: base64Data,
|
|
97
|
-
mimeType: "image/png"
|
|
98
|
-
}
|
|
99
|
-
],
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
console.error(`[DEBUG] QR code generation failed:`, error);
|
|
104
|
-
return {
|
|
105
|
-
content: [
|
|
106
|
-
{
|
|
107
|
-
type: "text",
|
|
108
|
-
text: `Error generating QR code: ${error instanceof Error ? error.message : 'Unknown error'}\n\nDebug info:\n- Text: \"${text}\"\n- Size: ${size}`,
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
// Fallback return in case of unexpected behavior
|
|
114
|
-
return {
|
|
115
|
-
content: [
|
|
116
|
-
{
|
|
117
|
-
type: "text",
|
|
118
|
-
text: "Unknown error: No response generated by qr-generate.",
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
|
-
// SVG placeholder generator
|
|
124
|
-
server.tool("svg-placeholder-generator", "Generate SVG placeholder images", {
|
|
125
|
-
width: z.number().describe("Width in pixels").optional(),
|
|
126
|
-
height: z.number().describe("Height in pixels").optional(),
|
|
127
|
-
backgroundColor: z.string().describe("Background color (hex)").optional(),
|
|
128
|
-
textColor: z.string().describe("Text color (hex)").optional(),
|
|
129
|
-
text: z.string().optional().describe("Custom text (default: dimensions)"),
|
|
130
|
-
}, async ({ width = 300, height = 200, backgroundColor = "#cccccc", textColor = "#666666", text }) => {
|
|
131
|
-
try {
|
|
132
|
-
if (width < 1 || width > 2000 || height < 1 || height > 2000) {
|
|
133
|
-
return {
|
|
134
|
-
content: [
|
|
135
|
-
{
|
|
136
|
-
type: "text",
|
|
137
|
-
text: "Width and height must be between 1 and 2000 pixels.",
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
const displayText = text || `${width}×${height}`;
|
|
143
|
-
const fontSize = Math.min(width, height) / 8;
|
|
144
|
-
const svg = `<svg width="${width}" height="${height}" xmlns="http://www.w3.org/2000/svg">
|
|
145
|
-
<rect width="100%" height="100%" fill="${backgroundColor}"/>
|
|
146
|
-
<text x="50%" y="50%" font-family="Arial, sans-serif" font-size="${fontSize}" fill="${textColor}" text-anchor="middle" dy=".3em">${displayText}</text>
|
|
147
|
-
</svg>`;
|
|
148
|
-
const dataUrl = `data:image/svg+xml;base64,${Buffer.from(svg).toString('base64')}`;
|
|
149
|
-
return {
|
|
150
|
-
content: [
|
|
151
|
-
{
|
|
152
|
-
type: "text",
|
|
153
|
-
text: `SVG Placeholder Generated:
|
|
154
|
-
|
|
155
|
-
Dimensions: ${width}×${height}
|
|
156
|
-
Background: ${backgroundColor}
|
|
157
|
-
Text Color: ${textColor}
|
|
158
|
-
Text: ${displayText}
|
|
159
|
-
|
|
160
|
-
SVG Code:
|
|
161
|
-
${svg}
|
|
162
|
-
|
|
163
|
-
Data URL:
|
|
164
|
-
${dataUrl}`,
|
|
165
|
-
},
|
|
166
|
-
],
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
catch (error) {
|
|
170
|
-
return {
|
|
171
|
-
content: [
|
|
172
|
-
{
|
|
173
|
-
type: "text",
|
|
174
|
-
text: `Error generating SVG placeholder: ${error instanceof Error ? error.message : 'Unknown error'}`,
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|