@composio/mastra 0.10.4-beta.0 → 0.10.5

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/README.md CHANGED
@@ -51,7 +51,7 @@ Each tool gets both an input and an output schema, so Mastra can validate tool r
51
51
 
52
52
  ## Strict mode
53
53
 
54
- Pass `strict: true` to drop every non-required property from each tool's input schema before Mastra compiles it:
54
+ Pass `strict: true` to normalize each tool's input schema for OpenAI structured outputs before Mastra compiles it: every object lists all of its properties in `required` and is closed, and optional properties stay available but accept `null`. A `null` is dropped before the tool runs unless the tool's own schema accepts `null` for that parameter, so nullable fields still receive an explicit `null`. Tools whose schema cannot be expressed in strict mode, such as objects that accept arbitrary keys, `allOf`, `prefixItems`, or unresolved `$ref`s, keep their original schema and log a warning:
55
55
 
56
56
  ```typescript
57
57
  const composio = new Composio({
package/dist/index.d.mts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { BaseAgenticProvider, ExecuteToolFn, McpUrlResponse, Tool } from "@composio/core";
2
2
  import { createTool } from "@mastra/core/tools";
3
3
  //#region src/index.d.ts
4
- type MastraTool = ReturnType<typeof createTool>;
5
- interface MastraToolCollection {
4
+ export type MastraTool = ReturnType<typeof createTool>;
5
+ export interface MastraToolCollection {
6
6
  [key: string]: MastraTool;
7
7
  }
8
- interface MastraUrlMap {
8
+ export interface MastraUrlMap {
9
9
  [name: string]: {
10
10
  url: string;
11
11
  };
12
12
  }
13
- declare class MastraProvider extends BaseAgenticProvider<MastraToolCollection, MastraTool, MastraUrlMap> {
13
+ export declare class MastraProvider extends BaseAgenticProvider<MastraToolCollection, MastraTool, MastraUrlMap> {
14
14
  readonly name = "mastra";
15
15
  private strict;
16
16
  private warnedDanglingRefs;
@@ -51,5 +51,4 @@ declare class MastraProvider extends BaseAgenticProvider<MastraToolCollection, M
51
51
  wrapTools(tools: Tool[], executeTool: ExecuteToolFn): MastraToolCollection;
52
52
  private warnDanglingRefOnce;
53
53
  }
54
- //#endregion
55
- export { MastraProvider, MastraTool, MastraToolCollection, MastraUrlMap };
54
+ //#endregion
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseAgenticProvider, dereferenceJsonSchema, logger, normalizeToolArguments, removeNonRequiredProperties, telemetry } from "@composio/core";
1
+ import { BaseAgenticProvider, dereferenceJsonSchema, logger, normalizeToolArguments, omitNullToolArguments, telemetry, toStrictJsonSchema } from "@composio/core";
2
2
  import { applyCompatLayer } from "@mastra/schema-compat";
3
3
  import { createTool } from "@mastra/core/tools";
4
4
 
@@ -140,7 +140,18 @@ var MastraProvider = class extends BaseAgenticProvider {
140
140
  }
141
141
  wrapTool(tool, executeTool) {
142
142
  const inputParams = tool.inputParameters;
143
- const parameters = this.strict && inputParams?.type === "object" ? removeNonRequiredProperties(inputParams) : inputParams;
143
+ let parameters = inputParams;
144
+ let strictSource;
145
+ if (this.strict && inputParams) {
146
+ const strict = toStrictJsonSchema(inputParams);
147
+ if (strict.unsupported.length > 0) {
148
+ const reasons = strict.unsupported.map((entry) => `${entry.path || "<root>"}: ${entry.keyword} (${entry.detail})`).join("; ");
149
+ logger.warn(`[composio/mastra] Tool ${JSON.stringify(tool.slug)} keeps its non-strict schema because it cannot be expressed as strict structured outputs: ${reasons}`);
150
+ } else {
151
+ parameters = strict.schema;
152
+ strictSource = strict.source;
153
+ }
154
+ }
144
155
  const onReplace = (ref, reason) => this.warnDanglingRefOnce(tool, ref, reason);
145
156
  const inputSchema = applyCompatLayer({
146
157
  schema: dereferenceJsonSchema(parameters ?? {}, {
@@ -164,7 +175,8 @@ var MastraProvider = class extends BaseAgenticProvider {
164
175
  inputSchema,
165
176
  outputSchema,
166
177
  execute: async (inputData, _context) => {
167
- return await executeTool(tool.slug, normalizeToolArguments(inputData, tool.slug));
178
+ const normalized = normalizeToolArguments(inputData, tool.slug);
179
+ return await executeTool(tool.slug, strictSource ? omitNullToolArguments(normalized, strictSource) : normalized);
168
180
  }
169
181
  });
170
182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@composio/mastra",
3
- "version": "0.10.4-beta.0",
3
+ "version": "0.10.5",
4
4
  "description": "Agentic Provider for mastra in Composio SDK",
5
5
  "main": "dist/index.mjs",
6
6
  "type": "module",
@@ -37,21 +37,21 @@
37
37
  "author": "",
38
38
  "license": "ISC",
39
39
  "peerDependencies": {
40
- "@composio/core": ">=1.0.0-beta.0 <2.0.0",
40
+ "@composio/core": ">=0.10.0 <1.0.0 || >=1.0.0-beta.0 <1.0.0",
41
41
  "@mastra/core": "^1.46.0",
42
42
  "zod": "^3.25 || ^4"
43
43
  },
44
44
  "devDependencies": {
45
- "@mastra/core": "1.52.1",
46
- "ai": "^6.0.263",
47
- "tsdown": "^0.22.14",
45
+ "@mastra/core": "1.53.0",
46
+ "ai": "^6.0.283",
47
+ "tsdown": "^0.23.0",
48
48
  "typescript": "^7.0.2",
49
- "vitest": "^4.1.11",
50
- "zod": "^4.4.3",
51
- "@composio/core": "1.0.0-beta.0"
49
+ "vitest": "^5.0.1",
50
+ "zod": "^4.5.4",
51
+ "@composio/core": "0.19.0"
52
52
  },
53
53
  "dependencies": {
54
- "@mastra/schema-compat": "^1.3.7"
54
+ "@mastra/schema-compat": "^1.3.10"
55
55
  },
56
56
  "scripts": {
57
57
  "clean": "git clean -xdf node_modules",