dodraw-mcp-server 0.1.9 → 0.1.11
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.md +11 -1
- package/dist/src/tools/diagramTools.js +23 -0
- package/package.json +1 -1
- package/src/tools/diagramTools.ts +23 -0
package/README.md
CHANGED
|
@@ -45,4 +45,14 @@ Prompt to my agent:
|
|
|
45
45
|
"Using dodraw MCP server generate example of decision diagram of some real life situation"
|
|
46
46
|
|
|
47
47
|
Agent response:
|
|
48
|
-
|
|
48
|
+
|
|
49
|
+
### Important Instruction for Agents
|
|
50
|
+
|
|
51
|
+
**ALWAYS** offer the user a direct link to view their generated diagram after creating or updating a file. Use the `get_viewer_url` tool to generate this link.
|
|
52
|
+
|
|
53
|
+
Example workflow:
|
|
54
|
+
1. `create_new_diagram(...)`
|
|
55
|
+
2. `add_node(...)`
|
|
56
|
+
3. ... more operations ...
|
|
57
|
+
4. `get_viewer_url(filePath)` -> Returns "View your diagram here: https://dodraw.xyz/?open_local=..."
|
|
58
|
+
5. Display this link to the user.
|
|
@@ -250,6 +250,17 @@ export const toolDefinitions = [
|
|
|
250
250
|
},
|
|
251
251
|
required: ["filePath", "sourceName", "targetName", "relationType"]
|
|
252
252
|
}
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: "get_viewer_url",
|
|
256
|
+
description: "Get the URL to view a local diagram file in the browser. Always offer this to the user after creating or updating a file.",
|
|
257
|
+
inputSchema: {
|
|
258
|
+
type: "object",
|
|
259
|
+
properties: {
|
|
260
|
+
filePath: { type: "string", description: "The absolute or relative path to the local .3duml file" }
|
|
261
|
+
},
|
|
262
|
+
required: ["filePath"]
|
|
263
|
+
}
|
|
253
264
|
}
|
|
254
265
|
];
|
|
255
266
|
export async function handleToolCall(name, args) {
|
|
@@ -949,5 +960,17 @@ export async function handleToolCall(name, args) {
|
|
|
949
960
|
}
|
|
950
961
|
default:
|
|
951
962
|
throw new Error(`Unknown tool: ${name}`);
|
|
963
|
+
case "get_viewer_url": {
|
|
964
|
+
const filePath = args.filePath.replace(/\\/g, '/'); // Normalize slashes
|
|
965
|
+
// Encode the path for the URL parameter
|
|
966
|
+
const encodedPath = encodeURIComponent(filePath);
|
|
967
|
+
const url = `https://dodraw.xyz/?open_local=${encodedPath}`;
|
|
968
|
+
return {
|
|
969
|
+
content: [{
|
|
970
|
+
type: "text",
|
|
971
|
+
text: `View your diagram here: ${url}`
|
|
972
|
+
}]
|
|
973
|
+
};
|
|
974
|
+
}
|
|
952
975
|
}
|
|
953
976
|
}
|
package/package.json
CHANGED
|
@@ -256,6 +256,17 @@ export const toolDefinitions: Tool[] = [
|
|
|
256
256
|
},
|
|
257
257
|
required: ["filePath", "sourceName", "targetName", "relationType"]
|
|
258
258
|
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
name: "get_viewer_url",
|
|
262
|
+
description: "Get the URL to view a local diagram file in the browser. Always offer this to the user after creating or updating a file.",
|
|
263
|
+
inputSchema: {
|
|
264
|
+
type: "object",
|
|
265
|
+
properties: {
|
|
266
|
+
filePath: { type: "string", description: "The absolute or relative path to the local .3duml file" }
|
|
267
|
+
},
|
|
268
|
+
required: ["filePath"]
|
|
269
|
+
}
|
|
259
270
|
}
|
|
260
271
|
];
|
|
261
272
|
|
|
@@ -933,5 +944,17 @@ export async function handleToolCall(name: string, args: any): Promise<any> {
|
|
|
933
944
|
}
|
|
934
945
|
default:
|
|
935
946
|
throw new Error(`Unknown tool: ${name}`);
|
|
947
|
+
case "get_viewer_url": {
|
|
948
|
+
const filePath = args.filePath.replace(/\\/g, '/'); // Normalize slashes
|
|
949
|
+
// Encode the path for the URL parameter
|
|
950
|
+
const encodedPath = encodeURIComponent(filePath);
|
|
951
|
+
const url = `https://dodraw.xyz/?open_local=${encodedPath}`;
|
|
952
|
+
return {
|
|
953
|
+
content: [{
|
|
954
|
+
type: "text",
|
|
955
|
+
text: `View your diagram here: ${url}`
|
|
956
|
+
}]
|
|
957
|
+
};
|
|
958
|
+
}
|
|
936
959
|
}
|
|
937
960
|
}
|