Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(mcp): name the refused tool call's wrong argument and document Composio argument names
koeria3f15b33c41ef
diff --git a/docs/composio.md b/docs/composio.mdindex efbf91f006..ae102d5dc4 100644--- a/docs/composio.md+++ b/docs/composio.md@@ -102,6 +102,31 @@ The hosted/managed connected-apps broker exposes the same account-aware responseEach bot can be kept to some of those accounts: open the bot's settings, then **Access**, turn on **Limit this bot to specific apps**, and under an app with two or more accounts tick **Accounts this bot may use**. The bot's calls that name another account are refused, its app-event automations can watch only the allowed accounts, and an automation whose account is later taken off the list starts no runs.+## Tool argument names come from each tool's schema++Every Composio tool advertises its own argument names, and two tools of the same app do not have to+agree on them:++- `GOOGLESHEETS_VALUES_GET` takes `spreadsheet_id` and `range`.+- `GOOGLESHEETS_BATCH_UPDATE_VALUES_BY_DATA_FILTER` takes `spreadsheetId`, `data` and+ `valueInputOption`.+- `GOOGLESHEETS_BATCH_GET` mixes both conventions in one schema: `spreadsheet_id` beside+ `valueRenderOption`.++Read the schema a tool advertises before the first call and use exactly those names. A call whose+arguments do not fit the advertised schema is refused before it reaches the app, and the refusal+names the tool and the first problem with the arguments, for example:++ Tool arguments do not match the advertised input schema: GOOGLESHEETS_VALUES_GET: must have required property 'spreadsheet_id'.++That refusal is about the shape of the call — the name and type of its arguments. It says nothing+about access, permissions or the account: a refused call does not mean the sheet, the mailbox or the+file is unreachable. Fix the argument names and call again.++The account to call with is chosen beside the tool, not inside the arguments: `account` names the+connected account for the call and is not one of the tool's arguments. With several accounts+connected for one app, a call needs one.+## Permissions the default connection does not ask forEach app you connect uses the Composio project's authorization for that app. Unless you set up your own, that is the Composio-managed one, which asks the provider only for Composio's default permissions. Some actions need more. In Gmail:diff --git a/server/drivers/chat-mcp-tools.test.ts b/server/drivers/chat-mcp-tools.test.tsindex be5eef32a9..90d5390219 100644--- a/server/drivers/chat-mcp-tools.test.ts+++ b/server/drivers/chat-mcp-tools.test.ts@@ -201,7 +201,8 @@ describe("Chat MCP session", () => {const session = await f.mount();expect(session.definitions).toEqual([{ type: "function", function: { name: "audit_write", description: "Fixture write", parameters: schema } }]);expect(f.read().calls.map((call) => call.method)).not.toContain("tools/call");- expect(() => session.validate("audit_write", { value: 42 })).toThrow("input schema");+ expect(() => session.validate("audit_write", { value: 42 })).toThrow(`Tool arguments do not match the advertised input schema: audit_write: value: must be string.`);+ expect(() => session.validate("audit_write", 7)).toThrow(`Tool arguments do not match the advertised input schema: audit_write: arguments must be an object.`);await expect(session.execute("not_registered", {}, f.controller.signal)).rejects.toThrow("not advertised");expect(f.read().calls.map((call) => call.method)).not.toContain("tools/call");await expect(session.execute("audit_write", { value: "receipt" }, f.controller.signal)).resolves.toEqual({ text: "recorded:receipt", ok: true });diff --git a/server/drivers/chat-mcp-tools.ts b/server/drivers/chat-mcp-tools.tsindex d317a087e5..a752018fbd 100644--- a/server/drivers/chat-mcp-tools.ts+++ b/server/drivers/chat-mcp-tools.ts@@ -491,7 +491,9 @@ function omitBlankDefaults(builtInBrowser: boolean, tool: string, args: unknown)type CheckedTool = { tool: Record<string, unknown> & { name: string; inputSchema: Record<string, unknown> }; schema: ValidateFunction; check: ServerToolCheck };type ToolOrigin = Omit<RegisteredTool, "name" | "schema">;-const ARGUMENTS_MISFIT = "Tool arguments do not match the advertised input schema; use its required fields and types";+const ARGUMENTS_MISFIT = (tool: string, problems: readonly string[]): string =>+ `Tool arguments do not match the advertised input schema: ${tool}: ${problems.join("; ") || "use its required fields and types"}.`;+const ARGUMENTS_NOT_OBJECT = "arguments must be an object";function checkedTools(tools: readonly unknown[], server: string): CheckedTool[] {const names = new Set<string>();@@ -826,7 +828,7 @@ export async function mountChatTools(integrations: SendTurnInput["integrations"]if (listedAs) {const call = listedAs === CALL_TOOL ? searchedCall(args) : undefined;if (call && selectionExcludes(call.tool, call.args)) throw new Error("Tool selection excludes this tool");- if (!object(args)) throw new Error(ARGUMENTS_MISFIT);+ if (!object(args)) throw new Error(ARGUMENTS_MISFIT(name, [ARGUMENTS_NOT_OBJECT]));return;}const tool = registered.get(name);@@ -834,7 +836,8 @@ export async function mountChatTools(integrations: SendTurnInput["integrations"]if (selectionExcludes(tool, args)) throw new Error("Tool selection excludes this tool");omitBlankDefaults(tool.builtInBrowser, tool.name, args);if (!object(args) || (!(tool.searched && isDirectoryTool(tool.name)) && !tool.schema(args))) {- throw new Error(readsAddressOnly(tool, args) ? readOpenPageOnly(tool.server) : ARGUMENTS_MISFIT);+ const problems = object(args) ? schemaProblems(tool.schema.errors) : [ARGUMENTS_NOT_OBJECT];+ throw new Error(readsAddressOnly(tool, args) ? readOpenPageOnly(tool.server) : ARGUMENTS_MISFIT(name, problems));}};const viewOf = (tool: RegisteredTool, args: Record<string, unknown>, title: string): ChatToolCallView => {