Skip to content

Commit d410b29

Browse files
committed
fix(docs): updated doc generator to handle arrays
1 parent afe7d2a commit d410b29

File tree

3 files changed

+40
-6
lines changed

3 files changed

+40
-6
lines changed

docs/content/docs/tools/browser_use.mdx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,27 @@ Execute browser automation tasks with BrowserUse to navigate the web, scrape dat
6565

6666
### `browser_use_run_task`
6767

68+
Runs a browser automation task using BrowserUse
69+
70+
#### Input
71+
72+
| Parameter | Type | Required | Description |
73+
| --------- | ---- | -------- | ----------- |
74+
| `task` | string | Yes | What should the browser agent do |
75+
| `apiKey` | string | Yes | API key for BrowserUse API |
76+
| `pollInterval` | number | No | Interval between polling requests in milliseconds \(default: 5000\) |
77+
| `maxPollTime` | number | No | Maximum time to poll for task completion in milliseconds \(default: 300000 - 5 minutes\) |
78+
79+
#### Output
80+
81+
| Parameter | Type |
82+
| --------- | ---- |
83+
| `id` | string |
84+
| `task` | string |
85+
| `output` | string |
86+
| `status` | string |
87+
| `steps` | string |
88+
| `live_url` | string |
6889

6990

7091

docs/content/docs/tools/mem0.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ Add memories to Mem0 for persistent storage and retrieval
4949
| `apiKey` | string | Yes | Your Mem0 API key |
5050
| `userId` | string | Yes | User ID associated with the memory |
5151
| `messages` | json | Yes | Array of message objects with role and content |
52-
| `version` | string | No | API version to use \(v1 or v2\). Use v2 if unsure. |
5352

5453
#### Output
5554

@@ -69,7 +68,6 @@ Search for memories in Mem0 using semantic search
6968
| `userId` | string | Yes | User ID to search memories for |
7069
| `query` | string | Yes | Search query to find relevant memories |
7170
| `limit` | number | No | Maximum number of results to return |
72-
| `version` | string | No | API version to use \(v1 or v2\). Use v2 if unsure. |
7371

7472
#### Output
7573

@@ -92,7 +90,6 @@ Retrieve memories from Mem0 by ID or filter criteria
9290
| `startDate` | string | No | Start date for filtering by created_at \(format: YYYY-MM-DD\) |
9391
| `endDate` | string | No | End date for filtering by created_at \(format: YYYY-MM-DD\) |
9492
| `limit` | number | No | Maximum number of results to return |
95-
| `version` | string | No | API version to use \(v1 or v2\). Use v2 if unsure. |
9693

9794
#### Output
9895

scripts/generate-block-docs.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ function extractToolInfo(toolName: string, fileContent: string, filePath: string
526526
// If we couldn't extract outputs from transformResponse, try an alternative approach
527527
if (Object.keys(outputs).length === 0) {
528528
// Look for output in successful response in transformResponse
529-
const successOutputRegex = /success\s*:\s*true,\s*output\s*:\s*(\{[^}]*\}|\w+(\.\w+)+\s*\|\|\s*\{[^}]*\})/
529+
const successOutputRegex = /success\s*:\s*true,\s*output\s*:\s*(\{[^}]*\}|\w+(\.\w+)+\s*\|\|\s*\{[^}]*\}|\w+(\.\w+)+\.map\s*\()/
530530
const successOutputMatch = fileContent.match(successOutputRegex)
531531

532532
if (successOutputMatch) {
@@ -536,6 +536,22 @@ function extractToolInfo(toolName: string, fileContent: string, filePath: string
536536
if (outputExpression.includes('||')) {
537537
outputs.data = 'json'
538538
}
539+
// Handle array mapping like "data.issues.map(...)"
540+
else if (outputExpression.includes('.map')) {
541+
// Try to extract the array object being mapped
542+
const arrayMapMatch = outputExpression.match(/(\w+(?:\.\w+)+)\.map/)
543+
if (arrayMapMatch) {
544+
const arrayPath = arrayMapMatch[1]
545+
// Get the base object being mapped to an array
546+
const arrayObject = arrayPath.split('.').pop()
547+
if (arrayObject) {
548+
outputs[arrayObject] = 'Array of mapped items'
549+
}
550+
} else {
551+
// Fallback if we can't extract the exact array object
552+
outputs.items = 'Array of mapped items'
553+
}
554+
}
539555
// Handle direct object assignment like "output: { field1, field2 }"
540556
else if (outputExpression.startsWith('{')) {
541557
const fieldMatches = outputExpression.match(/(\w+)\s*:/g)
@@ -657,8 +673,8 @@ async function getToolInfo(toolName: string): Promise<{
657673
let toolPrefix = toolName.split('_')[0]
658674
let toolSuffix = toolName.split('_').slice(1).join('_')
659675

660-
// Handle special cases for Google tools
661-
if (toolPrefix === 'google' && (toolName.startsWith('google_docs_') || toolName.startsWith('google_sheets_') || toolName.startsWith('google_drive_'))) {
676+
// Handle special cases for tools that have multiple parts
677+
if (toolPrefix === 'google' && (toolName.startsWith('google_docs_') || toolName.startsWith('google_sheets_') || toolName.startsWith('google_drive_')) || toolName.startsWith('browser_use')) {
662678
toolPrefix = toolName.split('_').slice(0, 2).join('_')
663679
toolSuffix = toolName.split('_').slice(2).join('_')
664680
}

0 commit comments

Comments
 (0)