@exulu/backend 1.48.2 → 1.49.0

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.
Files changed (164) hide show
  1. package/dist/index.cjs +351 -42
  2. package/dist/index.d.cts +96 -1
  3. package/dist/index.d.ts +96 -1
  4. package/dist/index.js +340 -38
  5. package/ee/{markdown.ts → chunking/markdown.ts} +2 -2
  6. package/ee/python/README.md +295 -0
  7. package/ee/python/documents/processing/README.md +155 -0
  8. package/ee/{documents → python/documents}/processing/doc_processor.ts +25 -17
  9. package/ee/{documents/processing/pdf_to_markdown.py → python/documents/processing/document_to_markdown.py} +3 -10
  10. package/ee/python/setup.sh +180 -0
  11. package/package.json +14 -3
  12. package/scripts/postinstall.cjs +149 -0
  13. package/.agents/skills/mintlify/SKILL.md +0 -347
  14. package/.editorconfig +0 -15
  15. package/.eslintrc.json +0 -52
  16. package/.github/workflows/release-backend.yml +0 -38
  17. package/.husky/commit-msg +0 -1
  18. package/.jscpd.json +0 -18
  19. package/.mcp.json +0 -25
  20. package/.nvmrc +0 -1
  21. package/.prettierignore +0 -5
  22. package/.prettierrc.json +0 -12
  23. package/CHANGELOG.md +0 -8
  24. package/SECURITY.md +0 -5
  25. package/commitlint.config.js +0 -4
  26. package/devops/documentation/patch-older-releases.md +0 -42
  27. package/ee/documents/processing/build_pdf_processor.sh +0 -35
  28. package/ee/documents/processing/chunk_markdown.py +0 -263
  29. package/ee/documents/processing/pdf_processor.spec +0 -115
  30. package/eslint.config.js +0 -88
  31. package/jest.config.ts +0 -25
  32. package/mintlify-docs/.mintignore +0 -7
  33. package/mintlify-docs/AGENTS.md +0 -33
  34. package/mintlify-docs/CLAUDE.MD +0 -50
  35. package/mintlify-docs/CONTRIBUTING.md +0 -32
  36. package/mintlify-docs/LICENSE +0 -21
  37. package/mintlify-docs/README.md +0 -55
  38. package/mintlify-docs/ai-tools/claude-code.mdx +0 -43
  39. package/mintlify-docs/ai-tools/cursor.mdx +0 -39
  40. package/mintlify-docs/ai-tools/windsurf.mdx +0 -39
  41. package/mintlify-docs/api-reference/core-types/agent-types.mdx +0 -110
  42. package/mintlify-docs/api-reference/core-types/analytics-types.mdx +0 -95
  43. package/mintlify-docs/api-reference/core-types/configuration-types.mdx +0 -83
  44. package/mintlify-docs/api-reference/core-types/evaluation-types.mdx +0 -106
  45. package/mintlify-docs/api-reference/core-types/job-types.mdx +0 -135
  46. package/mintlify-docs/api-reference/core-types/overview.mdx +0 -73
  47. package/mintlify-docs/api-reference/core-types/prompt-types.mdx +0 -102
  48. package/mintlify-docs/api-reference/core-types/rbac-types.mdx +0 -163
  49. package/mintlify-docs/api-reference/core-types/session-types.mdx +0 -77
  50. package/mintlify-docs/api-reference/core-types/user-management.mdx +0 -112
  51. package/mintlify-docs/api-reference/core-types/workflow-types.mdx +0 -88
  52. package/mintlify-docs/api-reference/core-types.mdx +0 -585
  53. package/mintlify-docs/api-reference/dynamic-types.mdx +0 -851
  54. package/mintlify-docs/api-reference/endpoint/create.mdx +0 -4
  55. package/mintlify-docs/api-reference/endpoint/delete.mdx +0 -4
  56. package/mintlify-docs/api-reference/endpoint/get.mdx +0 -4
  57. package/mintlify-docs/api-reference/endpoint/webhook.mdx +0 -4
  58. package/mintlify-docs/api-reference/introduction.mdx +0 -661
  59. package/mintlify-docs/api-reference/mutations.mdx +0 -1012
  60. package/mintlify-docs/api-reference/openapi.json +0 -217
  61. package/mintlify-docs/api-reference/queries.mdx +0 -1154
  62. package/mintlify-docs/backend/introduction.mdx +0 -218
  63. package/mintlify-docs/changelog.mdx +0 -387
  64. package/mintlify-docs/community-edition.mdx +0 -304
  65. package/mintlify-docs/core/exulu-agent/api-reference.mdx +0 -894
  66. package/mintlify-docs/core/exulu-agent/configuration.mdx +0 -690
  67. package/mintlify-docs/core/exulu-agent/introduction.mdx +0 -552
  68. package/mintlify-docs/core/exulu-app/api-reference.mdx +0 -481
  69. package/mintlify-docs/core/exulu-app/configuration.mdx +0 -319
  70. package/mintlify-docs/core/exulu-app/introduction.mdx +0 -117
  71. package/mintlify-docs/core/exulu-authentication.mdx +0 -810
  72. package/mintlify-docs/core/exulu-chunkers/api-reference.mdx +0 -1011
  73. package/mintlify-docs/core/exulu-chunkers/configuration.mdx +0 -596
  74. package/mintlify-docs/core/exulu-chunkers/introduction.mdx +0 -403
  75. package/mintlify-docs/core/exulu-context/api-reference.mdx +0 -911
  76. package/mintlify-docs/core/exulu-context/configuration.mdx +0 -648
  77. package/mintlify-docs/core/exulu-context/introduction.mdx +0 -394
  78. package/mintlify-docs/core/exulu-database.mdx +0 -811
  79. package/mintlify-docs/core/exulu-default-agents.mdx +0 -545
  80. package/mintlify-docs/core/exulu-eval/api-reference.mdx +0 -772
  81. package/mintlify-docs/core/exulu-eval/configuration.mdx +0 -680
  82. package/mintlify-docs/core/exulu-eval/introduction.mdx +0 -459
  83. package/mintlify-docs/core/exulu-logging.mdx +0 -464
  84. package/mintlify-docs/core/exulu-otel.mdx +0 -670
  85. package/mintlify-docs/core/exulu-queues/api-reference.mdx +0 -648
  86. package/mintlify-docs/core/exulu-queues/configuration.mdx +0 -650
  87. package/mintlify-docs/core/exulu-queues/introduction.mdx +0 -474
  88. package/mintlify-docs/core/exulu-reranker/api-reference.mdx +0 -630
  89. package/mintlify-docs/core/exulu-reranker/configuration.mdx +0 -663
  90. package/mintlify-docs/core/exulu-reranker/introduction.mdx +0 -516
  91. package/mintlify-docs/core/exulu-tool/api-reference.mdx +0 -723
  92. package/mintlify-docs/core/exulu-tool/configuration.mdx +0 -805
  93. package/mintlify-docs/core/exulu-tool/introduction.mdx +0 -539
  94. package/mintlify-docs/core/exulu-variables/api-reference.mdx +0 -699
  95. package/mintlify-docs/core/exulu-variables/configuration.mdx +0 -736
  96. package/mintlify-docs/core/exulu-variables/introduction.mdx +0 -511
  97. package/mintlify-docs/development.mdx +0 -94
  98. package/mintlify-docs/docs.json +0 -248
  99. package/mintlify-docs/enterprise-edition.mdx +0 -538
  100. package/mintlify-docs/essentials/code.mdx +0 -35
  101. package/mintlify-docs/essentials/images.mdx +0 -59
  102. package/mintlify-docs/essentials/markdown.mdx +0 -88
  103. package/mintlify-docs/essentials/navigation.mdx +0 -87
  104. package/mintlify-docs/essentials/reusable-snippets.mdx +0 -110
  105. package/mintlify-docs/essentials/settings.mdx +0 -318
  106. package/mintlify-docs/favicon.svg +0 -3
  107. package/mintlify-docs/frontend/introduction.mdx +0 -39
  108. package/mintlify-docs/getting-started.mdx +0 -267
  109. package/mintlify-docs/guides/custom-agent.mdx +0 -608
  110. package/mintlify-docs/guides/first-agent.mdx +0 -315
  111. package/mintlify-docs/images/admin_ui.png +0 -0
  112. package/mintlify-docs/images/contexts.png +0 -0
  113. package/mintlify-docs/images/create_agents.png +0 -0
  114. package/mintlify-docs/images/evals.png +0 -0
  115. package/mintlify-docs/images/graphql.png +0 -0
  116. package/mintlify-docs/images/graphql_api.png +0 -0
  117. package/mintlify-docs/images/hero-dark.png +0 -0
  118. package/mintlify-docs/images/hero-light.png +0 -0
  119. package/mintlify-docs/images/hero.png +0 -0
  120. package/mintlify-docs/images/knowledge_sources.png +0 -0
  121. package/mintlify-docs/images/mcp.png +0 -0
  122. package/mintlify-docs/images/scaling.png +0 -0
  123. package/mintlify-docs/index.mdx +0 -411
  124. package/mintlify-docs/logo/dark.svg +0 -9
  125. package/mintlify-docs/logo/light.svg +0 -9
  126. package/mintlify-docs/partners.mdx +0 -558
  127. package/mintlify-docs/products.mdx +0 -77
  128. package/mintlify-docs/snippets/snippet-intro.mdx +0 -4
  129. package/mintlify-docs/styles.css +0 -207
  130. package/ngrok.bash +0 -1
  131. package/ngrok.md +0 -6
  132. package/ngrok.yml +0 -10
  133. package/release.config.cjs +0 -15
  134. package/skills-lock.json +0 -10
  135. package/types/context-processor.ts +0 -45
  136. package/types/enums/eval-types.ts +0 -5
  137. package/types/enums/field-types.ts +0 -1
  138. package/types/enums/jobs.ts +0 -11
  139. package/types/enums/statistics.ts +0 -13
  140. package/types/exulu-table-definition.ts +0 -79
  141. package/types/file-types.ts +0 -18
  142. package/types/models/agent-session.ts +0 -27
  143. package/types/models/agent.ts +0 -68
  144. package/types/models/context.ts +0 -53
  145. package/types/models/embedding.ts +0 -17
  146. package/types/models/eval-run.ts +0 -40
  147. package/types/models/exulu-agent-tool-config.ts +0 -11
  148. package/types/models/item.ts +0 -21
  149. package/types/models/job.ts +0 -8
  150. package/types/models/project.ts +0 -16
  151. package/types/models/rate-limiter-rules.ts +0 -7
  152. package/types/models/test-case.ts +0 -25
  153. package/types/models/tool.ts +0 -9
  154. package/types/models/user-role.ts +0 -12
  155. package/types/models/user.ts +0 -20
  156. package/types/models/variable.ts +0 -8
  157. package/types/models/vector-methods.ts +0 -7
  158. package/types/provider-config.ts +0 -21
  159. package/types/queue-config.ts +0 -16
  160. package/types/rbac-rights-modes.ts +0 -1
  161. package/types/statistics.ts +0 -20
  162. package/types/workflow.ts +0 -31
  163. /package/ee/{documents → python/documents}/THIRD_PARTY_LICENSES/docling.txt +0 -0
  164. /package/ee/{documents/processing → python}/requirements.txt +0 -0
@@ -1,539 +0,0 @@
1
- ---
2
- title: "Overview"
3
- description: "Extend agent capabilities with custom tools for API calls, database queries, and external integrations"
4
- ---
5
-
6
- ## Overview
7
-
8
- `ExuluTool` represents a function that agents can call to perform specific actions or retrieve information. Tools are the primary way to extend agent capabilities beyond text generation, enabling them to interact with external systems, query databases, perform calculations, or execute custom business logic.
9
-
10
- ## Key features
11
-
12
- <CardGroup cols={2}>
13
- <Card title="AI SDK integration" icon="robot">
14
- Built on Vercel's AI SDK with native streaming support
15
- </Card>
16
- <Card title="Zod schema validation" icon="shield-check">
17
- Type-safe input validation with Zod schemas
18
- </Card>
19
- <Card title="Multiple tool types" icon="layer-group">
20
- Context search, function execution, agent delegation, web search
21
- </Card>
22
- <Card title="Configurable parameters" icon="sliders">
23
- Dynamic tool configuration with variables and defaults
24
- </Card>
25
- <Card title="Async & streaming" icon="stream">
26
- Support for async execution and streaming responses
27
- </Card>
28
- <Card title="Direct execution" icon="bolt">
29
- Execute tools directly or through agent workflows
30
- </Card>
31
- </CardGroup>
32
-
33
- ## What is a tool?
34
-
35
- A tool is a structured function that:
36
-
37
- 1. **Defines inputs** using Zod schemas for type safety and validation
38
- 2. **Executes logic** through an async function or generator
39
- 3. **Returns results** that agents can use to respond to users
40
- 4. **Integrates with AI SDK** for seamless agent tool calling
41
- 5. **Supports configuration** with dynamic parameters and variables
42
-
43
- Think of tools as the "hands" of your agents - they enable AI to take actions in your application.
44
-
45
- ## Quick start
46
-
47
- ```typescript
48
- import { ExuluTool } from "@exulu/backend";
49
- import { z } from "zod";
50
-
51
- // Create a simple calculator tool
52
- const calculatorTool = new ExuluTool({
53
- id: "calculator",
54
- name: "calculator",
55
- description: "Performs basic arithmetic operations",
56
- type: "function",
57
- category: "math",
58
- inputSchema: z.object({
59
- operation: z.enum(["add", "subtract", "multiply", "divide"]),
60
- a: z.number().describe("First number"),
61
- b: z.number().describe("Second number")
62
- }),
63
- config: [],
64
- execute: async ({ operation, a, b }) => {
65
- let result;
66
- switch (operation) {
67
- case "add":
68
- result = a + b;
69
- break;
70
- case "subtract":
71
- result = a - b;
72
- break;
73
- case "multiply":
74
- result = a * b;
75
- break;
76
- case "divide":
77
- result = a / b;
78
- break;
79
- }
80
-
81
- return {
82
- result: `${a} ${operation} ${b} = ${result}`
83
- };
84
- }
85
- });
86
-
87
- // Register with ExuluApp
88
- const app = new ExuluApp();
89
- await app.create({
90
- tools: {
91
- calculator: calculatorTool
92
- },
93
- config: { /* ... */ }
94
- });
95
- ```
96
-
97
- ## Tool types
98
-
99
- ExuluTool supports four distinct types:
100
-
101
- <Tabs>
102
- <Tab title="function">
103
- Custom functions that execute business logic, API calls, or data processing.
104
-
105
- ```typescript
106
- type: "function"
107
- ```
108
-
109
- Best for: Custom integrations, calculations, data transformations, API calls
110
- </Tab>
111
-
112
- <Tab title="context">
113
- Semantic search tools that query ExuluContext instances.
114
-
115
- ```typescript
116
- type: "context"
117
- ```
118
-
119
- Best for: RAG (retrieval-augmented generation), knowledge base queries
120
-
121
- <Note>
122
- Context tools are automatically generated when you create an ExuluContext with `enableAsTool: true`.
123
- </Note>
124
- </Tab>
125
-
126
- <Tab title="agent">
127
- Delegation tools that invoke other agents for specialized tasks.
128
-
129
- ```typescript
130
- type: "agent"
131
- ```
132
-
133
- Best for: Multi-agent workflows, task delegation, specialized expertise
134
- </Tab>
135
-
136
- <Tab title="web_search">
137
- Web search tools that fetch real-time information from the internet.
138
-
139
- ```typescript
140
- type: "web_search"
141
- ```
142
-
143
- Best for: Current events, fact-checking, research
144
- </Tab>
145
- </Tabs>
146
-
147
- ## Architecture
148
-
149
- ### AI SDK integration
150
-
151
- ExuluTool wraps Vercel's AI SDK `tool()` function, providing:
152
-
153
- ```typescript
154
- import { tool } from "ai";
155
-
156
- // Inside ExuluTool constructor
157
- this.tool = tool({
158
- description: description,
159
- inputSchema: inputSchema || z.object({}),
160
- execute
161
- });
162
- ```
163
-
164
- This enables seamless integration with AI SDK's streaming and tool calling features.
165
-
166
- ### Input schema with Zod
167
-
168
- Tools use Zod schemas to define and validate inputs:
169
-
170
- ```typescript
171
- inputSchema: z.object({
172
- userId: z.string().describe("The user ID to look up"),
173
- includeHistory: z.boolean().optional().describe("Include user history")
174
- })
175
- ```
176
-
177
- The schema serves three purposes:
178
- 1. **Type safety** - TypeScript types are inferred from the schema
179
- 2. **Validation** - Inputs are validated before execution
180
- 3. **Documentation** - Agents receive schema descriptions to understand parameters
181
-
182
- ### Execution patterns
183
-
184
- Tools support two execution patterns:
185
-
186
- <AccordionGroup>
187
- <Accordion title="Async function">
188
- Standard async function that returns a result:
189
-
190
- ```typescript
191
- execute: async (inputs) => {
192
- const data = await fetchData(inputs.userId);
193
- return {
194
- result: JSON.stringify(data)
195
- };
196
- }
197
- ```
198
- </Accordion>
199
-
200
- <Accordion title="Async generator">
201
- Generator function for streaming responses:
202
-
203
- ```typescript
204
- execute: async function* (inputs) {
205
- for await (const chunk of processData(inputs)) {
206
- yield {
207
- result: chunk
208
- };
209
- }
210
- }
211
- ```
212
- </Accordion>
213
- </AccordionGroup>
214
-
215
- ## Core concepts
216
-
217
- ### Tool identification
218
-
219
- Each tool has three identifiers:
220
-
221
- <ParamField path="id" type="string">
222
- Unique identifier used for database references. Must start with a letter or underscore, contain only alphanumeric characters and underscores, 5-80 characters long. **Should not change after creation.**
223
- </ParamField>
224
-
225
- <ParamField path="name" type="string">
226
- Human-readable name shown to agents and in UI. Used for tool invocation.
227
- </ParamField>
228
-
229
- <ParamField path="category" type="string">
230
- Optional category for organizing tools (e.g., "database", "api", "math")
231
- </ParamField>
232
-
233
- ```typescript
234
- {
235
- id: "get_user_profile",
236
- name: "get_user_profile",
237
- category: "database"
238
- }
239
- ```
240
-
241
- ### Tool configuration
242
-
243
- The `config` array defines runtime parameters that can be configured per tool instance:
244
-
245
- ```typescript
246
- config: [
247
- {
248
- name: "api_endpoint",
249
- description: "Base URL for the API",
250
- type: "string",
251
- default: "https://api.example.com"
252
- },
253
- {
254
- name: "enable_caching",
255
- description: "Enable response caching",
256
- type: "boolean",
257
- default: true
258
- },
259
- {
260
- name: "timeout",
261
- description: "Request timeout in milliseconds",
262
- type: "number",
263
- default: 5000
264
- },
265
- {
266
- name: "api_key",
267
- description: "API authentication key",
268
- type: "variable" // References ExuluVariables
269
- }
270
- ]
271
- ```
272
-
273
- Configuration types:
274
- - `string` - Text values
275
- - `number` - Numeric values
276
- - `boolean` - True/false flags
277
- - `variable` - References to ExuluVariables (for secrets/environment values)
278
-
279
- ### Return values
280
-
281
- Tool execution can return:
282
-
283
- <ResponseField name="result" type="string">
284
- The main result to return to the agent (often JSON stringified)
285
- </ResponseField>
286
-
287
- <ResponseField name="job" type="string">
288
- Optional job ID if the tool queued a background task
289
- </ResponseField>
290
-
291
- <ResponseField name="items" type="Item[]">
292
- Optional array of items (typically used by context search tools)
293
- </ResponseField>
294
-
295
- ```typescript
296
- return {
297
- result: JSON.stringify({ status: "success", data: userData }),
298
- job: "job-123-456" // If queued for background processing
299
- };
300
- ```
301
-
302
- ## Usage patterns
303
-
304
- ### As agent tools
305
-
306
- Tools are automatically available to agents when registered with ExuluApp:
307
-
308
- ```typescript
309
- const app = new ExuluApp();
310
- await app.create({
311
- tools: {
312
- calculator: calculatorTool,
313
- weatherLookup: weatherTool,
314
- databaseQuery: dbTool
315
- },
316
- agents: {
317
- assistant: assistantAgent
318
- },
319
- config: { /* ... */ }
320
- });
321
- ```
322
-
323
- Agents will automatically receive these tools and can call them during conversations based on user requests.
324
-
325
- ### Direct execution
326
-
327
- You can also execute tools directly in your code:
328
-
329
- ```typescript
330
- const result = await calculatorTool.execute({
331
- agent: "assistant",
332
- config: exuluConfig,
333
- user: currentUser,
334
- inputs: {
335
- operation: "add",
336
- a: 5,
337
- b: 3
338
- }
339
- });
340
-
341
- console.log(result.result); // "5 add 3 = 8"
342
- ```
343
-
344
- ### With streaming
345
-
346
- For long-running operations, use generators to stream results:
347
-
348
- ```typescript
349
- const processTool = new ExuluTool({
350
- id: "process_documents",
351
- name: "process_documents",
352
- description: "Processes multiple documents",
353
- type: "function",
354
- inputSchema: z.object({
355
- documentIds: z.array(z.string())
356
- }),
357
- config: [],
358
- execute: async function* ({ documentIds }) {
359
- for (const docId of documentIds) {
360
- const result = await processDocument(docId);
361
- yield {
362
- result: `Processed document ${docId}: ${result}`
363
- };
364
- }
365
- }
366
- });
367
- ```
368
-
369
- ## Common use cases
370
-
371
- <AccordionGroup>
372
- <Accordion title="Database queries">
373
- Create tools that query your database:
374
-
375
- ```typescript
376
- const getUserTool = new ExuluTool({
377
- id: "get_user",
378
- name: "get_user",
379
- description: "Retrieves user information from database",
380
- type: "function",
381
- inputSchema: z.object({
382
- userId: z.string()
383
- }),
384
- config: [],
385
- execute: async ({ userId }) => {
386
- const user = await db.users.findOne({ id: userId });
387
- return { result: JSON.stringify(user) };
388
- }
389
- });
390
- ```
391
- </Accordion>
392
-
393
- <Accordion title="API integrations">
394
- Wrap external APIs as tools:
395
-
396
- ```typescript
397
- const weatherTool = new ExuluTool({
398
- id: "weather",
399
- name: "get_weather",
400
- description: "Gets current weather for a location",
401
- type: "function",
402
- inputSchema: z.object({
403
- location: z.string(),
404
- units: z.enum(["metric", "imperial"]).optional()
405
- }),
406
- config: [
407
- {
408
- name: "api_key",
409
- description: "Weather API key",
410
- type: "variable"
411
- }
412
- ],
413
- execute: async ({ location, units = "metric" }) => {
414
- const response = await fetch(
415
- `https://api.weather.com?location=${location}&units=${units}`
416
- );
417
- const data = await response.json();
418
- return { result: JSON.stringify(data) };
419
- }
420
- });
421
- ```
422
- </Accordion>
423
-
424
- <Accordion title="Business logic">
425
- Encapsulate complex business logic:
426
-
427
- ```typescript
428
- const orderTool = new ExuluTool({
429
- id: "create_order",
430
- name: "create_order",
431
- description: "Creates a new order with validation and inventory check",
432
- type: "function",
433
- inputSchema: z.object({
434
- productId: z.string(),
435
- quantity: z.number().positive(),
436
- userId: z.string()
437
- }),
438
- config: [],
439
- execute: async ({ productId, quantity, userId }) => {
440
- // Check inventory
441
- const available = await checkInventory(productId);
442
- if (available < quantity) {
443
- return {
444
- result: JSON.stringify({
445
- success: false,
446
- error: "Insufficient inventory"
447
- })
448
- };
449
- }
450
-
451
- // Create order
452
- const order = await createOrder({ productId, quantity, userId });
453
-
454
- // Update inventory
455
- await updateInventory(productId, -quantity);
456
-
457
- return {
458
- result: JSON.stringify({
459
- success: true,
460
- orderId: order.id
461
- })
462
- };
463
- }
464
- });
465
- ```
466
- </Accordion>
467
-
468
- <Accordion title="File operations">
469
- Tools for file uploads, processing, and retrieval:
470
-
471
- ```typescript
472
- const fileProcessorTool = new ExuluTool({
473
- id: "process_pdf",
474
- name: "process_pdf",
475
- description: "Extracts text from PDF files",
476
- type: "function",
477
- inputSchema: z.object({
478
- fileKey: z.string().describe("S3 key of the PDF file")
479
- }),
480
- config: [],
481
- execute: async ({ fileKey }) => {
482
- const text = await extractTextFromPDF(fileKey);
483
- return {
484
- result: JSON.stringify({
485
- fileKey,
486
- extractedText: text,
487
- wordCount: text.split(/\s+/).length
488
- })
489
- };
490
- }
491
- });
492
- ```
493
- </Accordion>
494
- </AccordionGroup>
495
-
496
- ## Best practices
497
-
498
- <Note>
499
- **Input descriptions**: Always add `.describe()` to Zod schema fields. These descriptions help agents understand what each parameter does.
500
- </Note>
501
-
502
- <Warning>
503
- **ID stability**: Never change a tool's `id` after creation. The ID is used in database references and changing it will break existing integrations.
504
- </Warning>
505
-
506
- <Tip>
507
- **Error handling**: Always handle errors gracefully and return meaningful error messages in the result:
508
-
509
- ```typescript
510
- execute: async (inputs) => {
511
- try {
512
- const data = await riskyOperation(inputs);
513
- return { result: JSON.stringify(data) };
514
- } catch (error) {
515
- return {
516
- result: JSON.stringify({
517
- error: error.message,
518
- success: false
519
- })
520
- };
521
- }
522
- }
523
- ```
524
- </Tip>
525
-
526
- <Info>
527
- **JSON stringification**: Always stringify non-string results. Agents expect string results and will parse JSON automatically.
528
- </Info>
529
-
530
- ## Next steps
531
-
532
- <CardGroup cols={2}>
533
- <Card title="Configuration" icon="gear" href="/core/exulu-tool/configuration">
534
- Learn about all configuration options
535
- </Card>
536
- <Card title="API reference" icon="code" href="/core/exulu-tool/api-reference">
537
- Explore methods and properties
538
- </Card>
539
- </CardGroup>