fix(doc-generator): added in missing microsoft docs, fixed doc generator

This commit is contained in:
Waleed Latif
2025-05-28 10:11:35 -07:00
parent 84b9d766e9
commit 6e682f5f47
9 changed files with 129 additions and 53 deletions

View File

@@ -103,15 +103,88 @@ Integrate Microsoft Teams functionality to manage messages. Read content from ex
### `microsoft_teams_read_chat`
Read content from a Microsoft Teams chat
#### Input
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `accessToken` | string | Yes | The access token for the Microsoft Teams API |
| `chatId` | string | Yes | The ID of the chat to read from |
#### Output
| Parameter | Type |
| --------- | ---- |
| `content` | string |
| `metadata` | string |
| `messageCount` | string |
| `messages` | string |
| `totalAttachments` | string |
| `attachmentTypes` | string |
### `microsoft_teams_write_chat`
Write or update content in a Microsoft Teams chat
#### Input
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `accessToken` | string | Yes | The access token for the Microsoft Teams API |
| `chatId` | string | Yes | The ID of the chat to write to |
| `content` | string | Yes | The content to write to the message |
#### Output
| Parameter | Type |
| --------- | ---- |
| `updatedContent` | string |
| `metadata` | string |
### `microsoft_teams_read_channel`
Read content from a Microsoft Teams channel
#### Input
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `accessToken` | string | Yes | The access token for the Microsoft Teams API |
| `teamId` | string | Yes | The ID of the team to read from |
| `channelId` | string | Yes | The ID of the channel to read from |
#### Output
| Parameter | Type |
| --------- | ---- |
| `content` | string |
| `metadata` | string |
| `channelId` | string |
| `messageCount` | string |
| `messages` | string |
| `totalAttachments` | string |
| `attachmentTypes` | string |
### `microsoft_teams_write_channel`
Write or send a message to a Microsoft Teams channel
#### Input
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `accessToken` | string | Yes | The access token for the Microsoft Teams API |
| `teamId` | string | Yes | The ID of the team to write to |
| `channelId` | string | Yes | The ID of the channel to write to |
| `content` | string | Yes | The content to write to the channel |
#### Output
| Parameter | Type |
| --------- | ---- |
| `updatedContent` | string |
| `metadata` | string |

View File

@@ -45,14 +45,12 @@ export const airtableCreateRecordsTool: ToolConfig<AirtableCreateParams, Airtabl
Authorization: `Bearer ${params.accessToken}`,
'Content-Type': 'application/json',
}),
// Body should contain { records: [...] } and optionally { typecast: true }
body: (params) => ({ records: params.records }),
},
transformResponse: async (response) => {
const data = await response.json()
if (!response.ok) {
// logger.error('Airtable API error:', data)
throw new Error(data.error?.message || 'Failed to create Airtable records')
}
return {
@@ -67,7 +65,6 @@ export const airtableCreateRecordsTool: ToolConfig<AirtableCreateParams, Airtabl
},
transformError: (error: any) => {
// logger.error('Airtable tool error:', error)
return `Failed to create Airtable records: ${error.message || 'Unknown error'}`
},
}

View File

@@ -2,6 +2,6 @@ import { createTool } from './create'
import { readTool } from './read'
import { writeTool } from './write'
export const docsReadTool = readTool
export const docsWriteTool = writeTool
export const docsCreateTool = createTool
export const googleDocsReadTool = readTool
export const googleDocsWriteTool = writeTool
export const googleDocsCreateTool = createTool

View File

@@ -3,7 +3,7 @@ import { getContentTool } from './get_content'
import { listTool } from './list'
import { uploadTool } from './upload'
export const driveCreateFolderTool = createFolderTool
export const driveGetContentTool = getContentTool
export const driveListTool = listTool
export const driveUploadTool = uploadTool
export const googleDriveCreateFolderTool = createFolderTool
export const googleDriveGetContentTool = getContentTool
export const googleDriveListTool = listTool
export const googleDriveUploadTool = uploadTool

View File

@@ -3,7 +3,7 @@ import { readTool } from './read'
import { updateTool } from './update'
import { writeTool } from './write'
export const sheetsReadTool = readTool
export const sheetsWriteTool = writeTool
export const sheetsUpdateTool = updateTool
export const sheetsAppendTool = appendTool
export const googleSheetsReadTool = readTool
export const googleSheetsWriteTool = writeTool
export const googleSheetsUpdateTool = updateTool
export const googleSheetsAppendTool = appendTool

View File

@@ -27,18 +27,18 @@ import {
} from './github'
import { gmailReadTool, gmailSearchTool, gmailSendTool } from './gmail'
import { searchTool as googleSearchTool } from './google'
import { docsCreateTool, docsReadTool, docsWriteTool } from './google_docs'
import { googleDocsCreateTool, googleDocsReadTool, googleDocsWriteTool } from './google_docs'
import {
driveCreateFolderTool,
driveGetContentTool,
driveListTool,
driveUploadTool,
googleDriveCreateFolderTool,
googleDriveGetContentTool,
googleDriveListTool,
googleDriveUploadTool,
} from './google_drive'
import {
sheetsAppendTool,
sheetsReadTool,
sheetsUpdateTool,
sheetsWriteTool,
googleSheetsAppendTool,
googleSheetsReadTool,
googleSheetsUpdateTool,
googleSheetsWriteTool,
} from './google_sheets'
import { guestyGuestTool, guestyReservationTool } from './guesty'
import { requestTool as httpRequest } from './http'
@@ -139,17 +139,17 @@ export const tools: Record<string, ToolConfig> = {
reddit_hot_posts: redditHotPostsTool,
reddit_get_posts: redditGetPostsTool,
reddit_get_comments: redditGetCommentsTool,
google_drive_get_content: driveGetContentTool,
google_drive_list: driveListTool,
google_drive_upload: driveUploadTool,
google_drive_create_folder: driveCreateFolderTool,
google_docs_read: docsReadTool,
google_docs_write: docsWriteTool,
google_docs_create: docsCreateTool,
google_sheets_read: sheetsReadTool,
google_sheets_write: sheetsWriteTool,
google_sheets_update: sheetsUpdateTool,
google_sheets_append: sheetsAppendTool,
google_drive_get_content: googleDriveGetContentTool,
google_drive_list: googleDriveListTool,
google_drive_upload: googleDriveUploadTool,
google_drive_create_folder: googleDriveCreateFolderTool,
google_docs_read: googleDocsReadTool,
google_docs_write: googleDocsWriteTool,
google_docs_create: googleDocsCreateTool,
google_sheets_read: googleSheetsReadTool,
google_sheets_write: googleSheetsWriteTool,
google_sheets_update: googleSheetsUpdateTool,
google_sheets_append: googleSheetsAppendTool,
guesty_reservation: guestyReservationTool,
guesty_guest: guestyGuestTool,
perplexity_chat: perplexityChatTool,

View File

@@ -10,7 +10,6 @@ export const agentTool: ToolConfig<StagehandAgentParams, StagehandAgentResponse>
description: 'Run an autonomous web agent to complete tasks and extract structured data',
version: '1.0.0',
// Define the input parameters
params: {
task: {
type: 'string',
@@ -40,7 +39,6 @@ export const agentTool: ToolConfig<StagehandAgentParams, StagehandAgentResponse>
},
},
// Use HTTP request for server-side execution
request: {
url: '/api/tools/stagehand/agent',
method: 'POST',
@@ -64,7 +62,6 @@ export const agentTool: ToolConfig<StagehandAgentParams, StagehandAgentResponse>
},
},
// Transform the response
transformResponse: async (response) => {
try {
const data = await response.json()

View File

@@ -10,7 +10,6 @@ export const extractTool: ToolConfig<StagehandExtractParams, StagehandExtractRes
description: 'Extract structured data from a webpage using Stagehand',
version: '1.0.0',
// Define the input parameters
params: {
instruction: {
type: 'string',
@@ -34,7 +33,6 @@ export const extractTool: ToolConfig<StagehandExtractParams, StagehandExtractRes
},
},
// Use HTTP request for server-side execution
request: {
url: '/api/tools/stagehand/extract',
method: 'POST',
@@ -49,7 +47,6 @@ export const extractTool: ToolConfig<StagehandExtractParams, StagehandExtractRes
}),
},
// Transform the response
transformResponse: async (response) => {
try {
const data = await response.json()

View File

@@ -759,20 +759,32 @@ async function getToolInfo(toolName: string): Promise<{
outputs: Record<string, any>
} | null> {
try {
// Get tool prefix and suffix
let toolPrefix = toolName.split('_')[0]
let toolSuffix = toolName.split('_').slice(1).join('_')
// Split the tool name into parts
const parts = toolName.split('_')
// Handle special cases for tools that have multiple parts
if (
(toolPrefix === 'google' &&
(toolName.startsWith('google_docs_') ||
toolName.startsWith('google_sheets_') ||
toolName.startsWith('google_drive_'))) ||
toolName.startsWith('browser_use')
) {
toolPrefix = toolName.split('_').slice(0, 2).join('_')
toolSuffix = toolName.split('_').slice(2).join('_')
// Try to find the correct split point by checking if directories exist
let toolPrefix = ''
let toolSuffix = ''
// Start from the longest possible prefix and work backwards
for (let i = parts.length - 1; i >= 1; i--) {
const possiblePrefix = parts.slice(0, i).join('_')
const possibleSuffix = parts.slice(i).join('_')
// Check if a directory exists for this prefix
const toolDirPath = path.join(rootDir, `apps/sim/tools/${possiblePrefix}`)
if (fs.existsSync(toolDirPath) && fs.statSync(toolDirPath).isDirectory()) {
toolPrefix = possiblePrefix
toolSuffix = possibleSuffix
break
}
}
// If no directory was found, fall back to single-part prefix
if (!toolPrefix) {
toolPrefix = parts[0]
toolSuffix = parts.slice(1).join('_')
}
// Simplify the file search strategy