nworks 0.3.2 → 0.3.3
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 +21 -8
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +21 -8
- package/dist/mcp.js.map +1 -1
- package/package.json +1 -1
package/dist/mcp.js
CHANGED
|
@@ -14515,27 +14515,40 @@ function registerTools(server) {
|
|
|
14515
14515
|
);
|
|
14516
14516
|
server.tool(
|
|
14517
14517
|
"nworks_drive_download",
|
|
14518
|
-
"\uB4DC\uB77C\uC774\uBE0C \uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD569\uB2C8\uB2E4 (User OAuth file \uB610\uB294 file.read scope \uD544\uC694)",
|
|
14518
|
+
"\uB4DC\uB77C\uC774\uBE0C \uD30C\uC77C\uC744 \uB2E4\uC6B4\uB85C\uB4DC\uD569\uB2C8\uB2E4 (User OAuth file \uB610\uB294 file.read scope \uD544\uC694). outputDir\uC744 \uC9C0\uC815\uD558\uBA74 \uB85C\uCEEC\uC5D0 \uD30C\uC77C\uB85C \uC800\uC7A5\uD558\uACE0, \uBBF8\uC9C0\uC815 \uC2DC \uD30C\uC77C \uB0B4\uC6A9\uC744 \uC9C1\uC811 \uBC18\uD658\uD569\uB2C8\uB2E4 (\uD14D\uC2A4\uD2B8 \uD30C\uC77C\uC740 text, \uBC14\uC774\uB108\uB9AC\uB294 base64).",
|
|
14519
14519
|
{
|
|
14520
14520
|
fileId: external_exports.string().describe("\uB2E4\uC6B4\uB85C\uB4DC\uD560 \uD30C\uC77C ID"),
|
|
14521
|
-
outputDir: external_exports.string().optional().describe("\uC800\uC7A5 \uB514\uB809\uD1A0\uB9AC (\uBBF8\uC9C0\uC815 \uC2DC \
|
|
14521
|
+
outputDir: external_exports.string().optional().describe("\uC800\uC7A5 \uB514\uB809\uD1A0\uB9AC (\uC9C0\uC815 \uC2DC \uD30C\uC77C\uB85C \uC800\uC7A5, \uBBF8\uC9C0\uC815 \uC2DC \uB0B4\uC6A9\uC744 \uC9C1\uC811 \uBC18\uD658)"),
|
|
14522
14522
|
outputName: external_exports.string().optional().describe("\uC800\uC7A5 \uD30C\uC77C\uBA85 (\uBBF8\uC9C0\uC815 \uC2DC \uC6D0\uBCF8 \uD30C\uC77C\uBA85)"),
|
|
14523
14523
|
userId: external_exports.string().optional().describe("\uB300\uC0C1 \uC0AC\uC6A9\uC790 ID (\uBBF8\uC9C0\uC815 \uC2DC me)")
|
|
14524
14524
|
},
|
|
14525
14525
|
async ({ fileId, outputDir, outputName, userId }) => {
|
|
14526
14526
|
try {
|
|
14527
|
-
const { writeFile: writeFile2 } = await import("fs/promises");
|
|
14528
|
-
const { join: join2 } = await import("path");
|
|
14529
14527
|
const result = await downloadFile(
|
|
14530
14528
|
fileId,
|
|
14531
14529
|
userId ?? "me"
|
|
14532
14530
|
);
|
|
14533
14531
|
const fileName = outputName ?? result.fileName ?? fileId;
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14532
|
+
if (outputDir) {
|
|
14533
|
+
const { writeFile: writeFile2 } = await import("fs/promises");
|
|
14534
|
+
const { join: join2 } = await import("path");
|
|
14535
|
+
const outPath = join2(outputDir, fileName);
|
|
14536
|
+
await writeFile2(outPath, result.buffer);
|
|
14537
|
+
return {
|
|
14538
|
+
content: [{ type: "text", text: JSON.stringify({ success: true, fileName, path: outPath, size: result.buffer.length }) }]
|
|
14539
|
+
};
|
|
14540
|
+
}
|
|
14541
|
+
const textExtensions = /\.(txt|md|csv|json|xml|html|htm|css|js|ts|jsx|tsx|yaml|yml|toml|ini|cfg|conf|log|sh|bash|zsh|py|rb|java|go|rs|c|cpp|h|hpp|sql|graphql|env|gitignore|dockerignore|editorconfig)$/i;
|
|
14542
|
+
const isText = textExtensions.test(fileName);
|
|
14543
|
+
if (isText) {
|
|
14544
|
+
const text = result.buffer.toString("utf-8");
|
|
14545
|
+
return {
|
|
14546
|
+
content: [{ type: "text", text: JSON.stringify({ success: true, fileName, size: result.buffer.length, encoding: "text", content: text }) }]
|
|
14547
|
+
};
|
|
14548
|
+
}
|
|
14549
|
+
const base643 = result.buffer.toString("base64");
|
|
14537
14550
|
return {
|
|
14538
|
-
content: [{ type: "text", text: JSON.stringify({ success: true, fileName,
|
|
14551
|
+
content: [{ type: "text", text: JSON.stringify({ success: true, fileName, size: result.buffer.length, encoding: "base64", content: base643 }) }]
|
|
14539
14552
|
};
|
|
14540
14553
|
} catch (err) {
|
|
14541
14554
|
const error48 = err;
|