@ducci/jarvis 1.0.19 → 1.0.20
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/package.json +1 -1
- package/src/server/tools.js +21 -1
package/package.json
CHANGED
package/src/server/tools.js
CHANGED
|
@@ -124,7 +124,7 @@ const SEED_TOOLS = {
|
|
|
124
124
|
type: 'function',
|
|
125
125
|
function: {
|
|
126
126
|
name: 'save_tool',
|
|
127
|
-
description: 'Create or update a custom tool and make it available immediately in this session. Use this to build reusable JS tools for tasks you repeat. The tool code runs in Node.js and has access to: args, fs, path, process, require, __jarvisDir.',
|
|
127
|
+
description: 'Create or update a custom tool and make it available immediately in this session. Use this to build reusable JS tools for tasks you repeat. The tool code runs in Node.js and has access to: args, fs, path, process, require, __jarvisDir. To update an existing tool, first call get_tool to read its current code and parameters, then call save_tool with your modifications.',
|
|
128
128
|
parameters: {
|
|
129
129
|
type: 'object',
|
|
130
130
|
properties: {
|
|
@@ -151,6 +151,26 @@ const SEED_TOOLS = {
|
|
|
151
151
|
},
|
|
152
152
|
code: `const toolsFile = path.join(process.env.HOME, '.jarvis/data/tools/tools.json'); const raw = await fs.promises.readFile(toolsFile, 'utf8').catch(() => '{}'); const tools = JSON.parse(raw); tools[args.name] = { definition: { type: 'function', function: { name: args.name, description: args.description, parameters: args.parameters } }, code: args.code }; await fs.promises.writeFile(toolsFile, JSON.stringify(tools, null, 2), 'utf8'); return { status: 'ok', saved: args.name };`,
|
|
153
153
|
},
|
|
154
|
+
get_tool: {
|
|
155
|
+
definition: {
|
|
156
|
+
type: 'function',
|
|
157
|
+
function: {
|
|
158
|
+
name: 'get_tool',
|
|
159
|
+
description: 'Read the full definition and code of a single tool by name. Use this before updating an existing tool so you understand its current implementation.',
|
|
160
|
+
parameters: {
|
|
161
|
+
type: 'object',
|
|
162
|
+
properties: {
|
|
163
|
+
name: {
|
|
164
|
+
type: 'string',
|
|
165
|
+
description: 'The tool name to retrieve.',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
required: ['name'],
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
code: `const toolsFile = path.join(process.env.HOME, '.jarvis/data/tools/tools.json'); const raw = await fs.promises.readFile(toolsFile, 'utf8').catch(() => '{}'); const tools = JSON.parse(raw); const tool = tools[args.name]; if (!tool) return { status: 'not_found', name: args.name }; return { status: 'ok', name: args.name, definition: tool.definition, code: tool.code };`,
|
|
173
|
+
},
|
|
154
174
|
list_tools: {
|
|
155
175
|
definition: {
|
|
156
176
|
type: 'function',
|