@agentwonderland/mcp 0.1.6 → 0.1.7
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/core/file-upload.js +3 -2
- package/dist/tools/run.js +9 -2
- package/dist/tools/solve.js +17 -3
- package/package.json +1 -1
- package/src/core/file-upload.ts +3 -2
- package/src/tools/run.ts +8 -2
- package/src/tools/solve.ts +15 -3
package/dist/core/file-upload.js
CHANGED
|
@@ -93,8 +93,9 @@ export async function uploadLocalFiles(input) {
|
|
|
93
93
|
try {
|
|
94
94
|
result[key] = await uploadFile(value);
|
|
95
95
|
}
|
|
96
|
-
catch {
|
|
97
|
-
|
|
96
|
+
catch (err) {
|
|
97
|
+
const msg = err instanceof Error ? err.message : "unknown error";
|
|
98
|
+
throw new Error(`Failed to upload file "${value}" for field "${key}": ${msg}`);
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
return result;
|
package/dist/tools/run.js
CHANGED
|
@@ -14,7 +14,7 @@ function multiText(...blocks) {
|
|
|
14
14
|
// Pending confirmations: agent_id → { agent, input, method }
|
|
15
15
|
const pendingRuns = new Map();
|
|
16
16
|
export function registerRunTools(server) {
|
|
17
|
-
server.tool("run_agent", "Run an AI agent from the marketplace. Pays automatically via configured wallet. Returns the agent's output, cost, and job ID for tracking. If spending confirmation is enabled, first call returns a price quote — call again with confirmed: true to execute.", {
|
|
17
|
+
server.tool("run_agent", "Run an AI agent from the marketplace. Pays automatically via configured wallet. Returns the agent's output, cost, and job ID for tracking. If spending confirmation is enabled, first call returns a price quote — call again with confirmed: true to execute. Local file paths in the input (e.g. /Users/.../photo.jpg) are automatically uploaded to temporary storage and replaced with download URLs — just pass the path directly, no base64 encoding needed.", {
|
|
18
18
|
agent_id: z.string().describe("Agent ID (UUID, slug, or name)"),
|
|
19
19
|
input: z.record(z.unknown()).describe("Input payload for the agent"),
|
|
20
20
|
pay_with: z.string().optional().describe("Payment method — wallet ID, chain name (tempo, base, etc.), or 'card'. Auto-detected if omitted."),
|
|
@@ -55,7 +55,14 @@ export function registerRunTools(server) {
|
|
|
55
55
|
].join("\n"));
|
|
56
56
|
}
|
|
57
57
|
const method = pay_with;
|
|
58
|
-
|
|
58
|
+
let processedInput;
|
|
59
|
+
try {
|
|
60
|
+
processedInput = await uploadLocalFiles(input);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
const msg = err instanceof Error ? err.message : "File upload failed";
|
|
64
|
+
return text(`Error: ${msg}`);
|
|
65
|
+
}
|
|
59
66
|
let result;
|
|
60
67
|
try {
|
|
61
68
|
result = await apiPostWithPayment(`/agents/${agent.id}/run`, { input: processedInput }, method);
|
package/dist/tools/solve.js
CHANGED
|
@@ -44,7 +44,7 @@ async function autoTip(jobId, agentId, agentName, feedbackToken) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
export function registerSolveTools(server) {
|
|
47
|
-
server.tool("solve", "Solve a task by finding the best agent, paying, and executing. The primary way to use the marketplace. If spending confirmation is enabled, returns a price quote first — call again with confirmed: true to execute.", {
|
|
47
|
+
server.tool("solve", "Solve a task by finding the best agent, paying, and executing. The primary way to use the marketplace. If spending confirmation is enabled, returns a price quote first — call again with confirmed: true to execute. Local file paths in the input (e.g. /Users/.../photo.jpg) are automatically uploaded to temporary storage and replaced with download URLs — just pass the path directly, no base64 encoding needed.", {
|
|
48
48
|
intent: z
|
|
49
49
|
.string()
|
|
50
50
|
.describe("What you want to accomplish (natural language)"),
|
|
@@ -76,8 +76,15 @@ export function registerSolveTools(server) {
|
|
|
76
76
|
}
|
|
77
77
|
const method = pay_with ?? getConfiguredMethods()[0];
|
|
78
78
|
// Path 1: If authenticated, use the platform /solve route
|
|
79
|
+
let processedInput;
|
|
80
|
+
try {
|
|
81
|
+
processedInput = await uploadLocalFiles(input);
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
const msg = err instanceof Error ? err.message : "File upload failed";
|
|
85
|
+
return text(`Error: ${msg}`);
|
|
86
|
+
}
|
|
79
87
|
try {
|
|
80
|
-
const processedInput = await uploadLocalFiles(input);
|
|
81
88
|
const result = await apiPost("/solve", {
|
|
82
89
|
intent,
|
|
83
90
|
input: processedInput,
|
|
@@ -140,7 +147,14 @@ export function registerSolveTools(server) {
|
|
|
140
147
|
].join("\n"));
|
|
141
148
|
}
|
|
142
149
|
let result;
|
|
143
|
-
|
|
150
|
+
let processedInput2;
|
|
151
|
+
try {
|
|
152
|
+
processedInput2 = await uploadLocalFiles(input);
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
const msg = err instanceof Error ? err.message : "File upload failed";
|
|
156
|
+
return text(`Error: ${msg}`);
|
|
157
|
+
}
|
|
144
158
|
try {
|
|
145
159
|
result = await apiPostWithPayment(`/agents/${selected.id}/run`, { input: processedInput2 }, method);
|
|
146
160
|
}
|
package/package.json
CHANGED
package/src/core/file-upload.ts
CHANGED
|
@@ -105,8 +105,9 @@ export async function uploadLocalFiles(
|
|
|
105
105
|
|
|
106
106
|
try {
|
|
107
107
|
result[key] = await uploadFile(value);
|
|
108
|
-
} catch {
|
|
109
|
-
|
|
108
|
+
} catch (err) {
|
|
109
|
+
const msg = err instanceof Error ? err.message : "unknown error";
|
|
110
|
+
throw new Error(`Failed to upload file "${value}" for field "${key}": ${msg}`);
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
|
package/src/tools/run.ts
CHANGED
|
@@ -25,7 +25,7 @@ const pendingRuns = new Map<string, {
|
|
|
25
25
|
export function registerRunTools(server: McpServer): void {
|
|
26
26
|
server.tool(
|
|
27
27
|
"run_agent",
|
|
28
|
-
"Run an AI agent from the marketplace. Pays automatically via configured wallet. Returns the agent's output, cost, and job ID for tracking. If spending confirmation is enabled, first call returns a price quote — call again with confirmed: true to execute.",
|
|
28
|
+
"Run an AI agent from the marketplace. Pays automatically via configured wallet. Returns the agent's output, cost, and job ID for tracking. If spending confirmation is enabled, first call returns a price quote — call again with confirmed: true to execute. Local file paths in the input (e.g. /Users/.../photo.jpg) are automatically uploaded to temporary storage and replaced with download URLs — just pass the path directly, no base64 encoding needed.",
|
|
29
29
|
{
|
|
30
30
|
agent_id: z.string().describe("Agent ID (UUID, slug, or name)"),
|
|
31
31
|
input: z.record(z.unknown()).describe("Input payload for the agent"),
|
|
@@ -74,7 +74,13 @@ export function registerRunTools(server: McpServer): void {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
const method = pay_with;
|
|
77
|
-
|
|
77
|
+
let processedInput: Record<string, unknown>;
|
|
78
|
+
try {
|
|
79
|
+
processedInput = await uploadLocalFiles(input);
|
|
80
|
+
} catch (err) {
|
|
81
|
+
const msg = err instanceof Error ? err.message : "File upload failed";
|
|
82
|
+
return text(`Error: ${msg}`);
|
|
83
|
+
}
|
|
78
84
|
let result: Record<string, unknown>;
|
|
79
85
|
try {
|
|
80
86
|
result = await apiPostWithPayment<Record<string, unknown>>(
|
package/src/tools/solve.ts
CHANGED
|
@@ -55,7 +55,7 @@ async function autoTip(jobId: string, agentId: string, agentName: string, feedba
|
|
|
55
55
|
export function registerSolveTools(server: McpServer): void {
|
|
56
56
|
server.tool(
|
|
57
57
|
"solve",
|
|
58
|
-
"Solve a task by finding the best agent, paying, and executing. The primary way to use the marketplace. If spending confirmation is enabled, returns a price quote first — call again with confirmed: true to execute.",
|
|
58
|
+
"Solve a task by finding the best agent, paying, and executing. The primary way to use the marketplace. If spending confirmation is enabled, returns a price quote first — call again with confirmed: true to execute. Local file paths in the input (e.g. /Users/.../photo.jpg) are automatically uploaded to temporary storage and replaced with download URLs — just pass the path directly, no base64 encoding needed.",
|
|
59
59
|
{
|
|
60
60
|
intent: z
|
|
61
61
|
.string()
|
|
@@ -95,8 +95,14 @@ export function registerSolveTools(server: McpServer): void {
|
|
|
95
95
|
const method = pay_with ?? getConfiguredMethods()[0];
|
|
96
96
|
|
|
97
97
|
// Path 1: If authenticated, use the platform /solve route
|
|
98
|
+
let processedInput: Record<string, unknown>;
|
|
99
|
+
try {
|
|
100
|
+
processedInput = await uploadLocalFiles(input);
|
|
101
|
+
} catch (err) {
|
|
102
|
+
const msg = err instanceof Error ? err.message : "File upload failed";
|
|
103
|
+
return text(`Error: ${msg}`);
|
|
104
|
+
}
|
|
98
105
|
try {
|
|
99
|
-
const processedInput = await uploadLocalFiles(input);
|
|
100
106
|
const result = await apiPost<Record<string, unknown>>("/solve", {
|
|
101
107
|
intent,
|
|
102
108
|
input: processedInput,
|
|
@@ -169,7 +175,13 @@ export function registerSolveTools(server: McpServer): void {
|
|
|
169
175
|
}
|
|
170
176
|
|
|
171
177
|
let result: Record<string, unknown>;
|
|
172
|
-
|
|
178
|
+
let processedInput2: Record<string, unknown>;
|
|
179
|
+
try {
|
|
180
|
+
processedInput2 = await uploadLocalFiles(input);
|
|
181
|
+
} catch (err) {
|
|
182
|
+
const msg = err instanceof Error ? err.message : "File upload failed";
|
|
183
|
+
return text(`Error: ${msg}`);
|
|
184
|
+
}
|
|
173
185
|
try {
|
|
174
186
|
result = await apiPostWithPayment<Record<string, unknown>>(
|
|
175
187
|
`/agents/${selected.id}/run`,
|