@langgraph-js/sdk 1.9.0 → 1.9.2

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.
@@ -55,12 +55,7 @@ export declare class ToolManager {
55
55
  toJSON(graphId: string, remote?: boolean): Promise<{
56
56
  name: string;
57
57
  description: string;
58
- parameters: import("zod-to-json-schema").JsonSchema7Type & {
59
- $schema?: string | undefined;
60
- definitions?: {
61
- [key: string]: import("zod-to-json-schema").JsonSchema7Type;
62
- } | undefined;
63
- };
58
+ parameters: any;
64
59
  }[]>;
65
60
  /**
66
61
  * @zh 标记指定 ID 的工具等待已完成,并传递结果。
@@ -18,6 +18,8 @@ export interface UnionTool<Args extends ZodRawShape, Child extends Object = Obje
18
18
  allowAgent?: string[];
19
19
  /** 只允许指定的 Graph 使用该工具 */
20
20
  allowGraph?: string[];
21
+ /** 是否是纯净的 json schema 参数,而不是 zod 参数 */
22
+ isPureParams?: boolean;
21
23
  }
22
24
  export type ToolCallback<Args extends ZodRawShape> = (args: z.objectOutputType<Args, ZodTypeAny>, context?: any) => CallToolResult | Promise<CallToolResult>;
23
25
  export type CallToolResult = string | {
@@ -43,12 +45,17 @@ export declare const createFETool: <const T extends Parameter[], Args extends Zo
43
45
  export declare const createJSONDefineTool: <Args extends ZodRawShape>(tool: UnionTool<Args>) => {
44
46
  name: string;
45
47
  description: string;
46
- parameters: import("zod-to-json-schema").JsonSchema7Type & {
48
+ parameters: Args | ({
49
+ title?: string;
50
+ default?: any;
51
+ description?: string;
52
+ markdownDescription?: string;
53
+ } & {
47
54
  $schema?: string | undefined;
48
55
  definitions?: {
49
56
  [key: string]: import("zod-to-json-schema").JsonSchema7Type;
50
57
  } | undefined;
51
- };
58
+ });
52
59
  };
53
60
  export declare const createMCPTool: <Args extends ZodRawShape>(tool: UnionTool<Args>) => (string | Args | ((args: z.objectOutputType<Args, ZodTypeAny>) => Promise<{
54
61
  content: {
@@ -63,7 +63,7 @@ export const createJSONDefineTool = (tool) => {
63
63
  return {
64
64
  name: tool.name,
65
65
  description: tool.description,
66
- parameters: zodToJsonSchema(z.object(tool.parameters)),
66
+ parameters: tool.isPureParams ? tool.parameters : zodToJsonSchema(z.object(tool.parameters)),
67
67
  };
68
68
  };
69
69
  export const createMCPTool = (tool) => {
@@ -49,6 +49,7 @@ export declare const createChatStore: (initClientName: string, config: LangGraph
49
49
  tools: import("nanostores").PreinitializedWritableAtom<UnionTool<any, Object, any>[]> & object;
50
50
  };
51
51
  mutations: {
52
+ refreshTools: () => Promise<void>;
52
53
  setTools(new_tools: UnionTool<any>[]): void;
53
54
  isFELocking(): boolean | undefined;
54
55
  initClient: () => Promise<LangGraphClient>;
@@ -133,6 +133,7 @@ export const createChatStore = (initClientName, config, context = {}) => {
133
133
  client.set(newClient);
134
134
  if (showGraph.get())
135
135
  refreshGraph();
136
+ refreshTools();
136
137
  return newClient;
137
138
  }
138
139
  /**
@@ -224,6 +225,7 @@ export const createChatStore = (initClientName, config, context = {}) => {
224
225
  tools,
225
226
  },
226
227
  mutations: {
228
+ refreshTools,
227
229
  setTools(new_tools) {
228
230
  tools.set(new_tools);
229
231
  refreshTools();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langgraph-js/sdk",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "The UI SDK for LangGraph - seamlessly integrate your AI agents with frontend interfaces",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -21,6 +21,8 @@ export interface UnionTool<Args extends ZodRawShape, Child extends Object = Obje
21
21
  allowAgent?: string[];
22
22
  /** 只允许指定的 Graph 使用该工具 */
23
23
  allowGraph?: string[];
24
+ /** 是否是纯净的 json schema 参数,而不是 zod 参数 */
25
+ isPureParams?: boolean;
24
26
  }
25
27
  export type ToolCallback<Args extends ZodRawShape> = (args: z.objectOutputType<Args, ZodTypeAny>, context?: any) => CallToolResult | Promise<CallToolResult>;
26
28
 
@@ -95,7 +97,7 @@ export const createJSONDefineTool = <Args extends ZodRawShape>(tool: UnionTool<A
95
97
  return {
96
98
  name: tool.name,
97
99
  description: tool.description,
98
- parameters: zodToJsonSchema(z.object(tool.parameters)),
100
+ parameters: tool.isPureParams ? tool.parameters : zodToJsonSchema(z.object(tool.parameters)),
99
101
  };
100
102
  };
101
103
 
@@ -138,6 +138,7 @@ export const createChatStore = (
138
138
  newClient.graphState = {};
139
139
  client.set(newClient);
140
140
  if (showGraph.get()) refreshGraph();
141
+ refreshTools();
141
142
  return newClient;
142
143
  }
143
144
 
@@ -233,6 +234,7 @@ export const createChatStore = (
233
234
  tools,
234
235
  },
235
236
  mutations: {
237
+ refreshTools,
236
238
  setTools(new_tools: UnionTool<any>[]) {
237
239
  tools.set(new_tools);
238
240
  refreshTools();