@hotmeshio/long-tail 0.1.20 → 0.1.21
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/build/api/mcp/tools.js +9 -4
- package/package.json +1 -1
package/build/api/mcp/tools.js
CHANGED
|
@@ -45,10 +45,15 @@ async function callMcpTool(input, auth) {
|
|
|
45
45
|
if (!adapter) {
|
|
46
46
|
return { status: 400, error: 'MCP adapter not registered' };
|
|
47
47
|
}
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
const effectiveUserId = input.execute_as || auth?.userId;
|
|
49
|
+
const authContext = effectiveUserId ? { userId: effectiveUserId } : undefined;
|
|
50
|
+
// Inject user_id into arguments so builtin tools can resolve
|
|
51
|
+
// the calling user's credentials (OAuth tokens, etc.)
|
|
52
|
+
const args = { ...(input.arguments || {}) };
|
|
53
|
+
if (effectiveUserId && !args.user_id) {
|
|
54
|
+
args.user_id = effectiveUserId;
|
|
55
|
+
}
|
|
56
|
+
const result = await adapter.callTool(input.id, input.toolName, args, authContext);
|
|
52
57
|
return { status: 200, data: { result } };
|
|
53
58
|
}
|
|
54
59
|
catch (err) {
|
package/package.json
CHANGED