https://linen.dev logo
toolset.getTools() is in not compatible with verce...
# 🖥│support-forum
k
Hey, after upgrading to vercel's aisdk v5,
toolset.getTools()
results are not compatible. I had to write a middleware to transform the results to make it compatible
Copy code
const wrapComposioTools = (tools: ToolSet): ToolSet => {
  const wrapped: ToolSet = {};
  for (const [name, t] of Object.entries<any>(tools)) {
    const hasComposioJsonSchema = t?.parameters?.jsonSchema;
    if (hasComposioJsonSchema) {
      const description = t?.description ?? name;
      const schemaObject = t.parameters.jsonSchema ?? {
        type: "object",
        properties: {},
      };
      const execute =
        typeof t?.execute === "function"
          ? t.execute.bind(t)
          : async () => ({ success: false, error: "No execute provided" });

      wrapped[name] = tool({
        description,
        inputSchema: jsonSchema(schemaObject),
        execute: async (args: any) => execute(args),
      });
    } else {
      wrapped[name] = t as any;
    }
  }
  return wrapped;
};
c
Hi Karthik, could you please share your SDK version? This will help us provide a resolution faster. Thanks!
Also, could you share a reproducible code snippet?
g
y'all should look into shipping aisdk v5 support soon
k
@udaysidagana 0.5.39
Copy code
const linearTools = await toolset.getTools({
    apps: ["linear"],
    actions: [
      "LINEAR_GET_LINEAR_ISSUE",
      "LINEAR_CREATE_LINEAR_ATTACHMENT",
      "LINEAR_CREATE_LINEAR_ISSUE",
      "LINEAR_CREATE_LINEAR_COMMENT",
      "LINEAR_CREATE_LINEAR_ISSUE_DETAILS",
      "LINEAR_LIST_LINEAR_ISSUES",
      "LINEAR_LIST_LINEAR_PROJECTS",
      "LINEAR_LIST_LINEAR_STATES",
      "LINEAR_LIST_LINEAR_TEAMS",
      "LINEAR_RUN_QUERY_OR_MUTATION",
    ],
  });

const wrappedLinearTools = wrapComposioTools(linearTools)

# aisdk
await generateText(
...
tools: wrappedLinearTools,
...
)
@udaysidagana @abhishekpatil4 any updates on this? Thanks
a
This blocking me to upgrading to Ai SDK v5 also
up