@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.
@@ -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 authContext = (input.execute_as || auth?.userId)
49
- ? { userId: input.execute_as || auth?.userId }
50
- : undefined;
51
- const result = await adapter.callTool(input.id, input.toolName, input.arguments || {}, authContext);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hotmeshio/long-tail",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Long Tail Workflows — Durable AI workflows with human-in-the-loop escalation. Powered by PostgreSQL.",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",