From 1908b53f5f4c101fbacf0532f6c7b4c2ce7c94d9 Mon Sep 17 00:00:00 2001 From: S2D2 Date: Wed, 11 Nov 2026 01:30:30 +0000 Subject: [PATCH 1/3] fix(examples): make the framework examples run end to end Running every example against a local StackOne MCP stand-in, with real OpenAI and Claude models, showed four examples that fail or print the wrong thing on main: - openai-responses-integration: OpenAI rejects the strict schema (400 "additionalProperties is required" for nested query objects), so the example and README now pass { strict: false }, as the toOpenAIResponses doc already advises for StackOne actions. - ai-sdk-integration: AI SDK 5+ tool calls carry `input`, not `args`, so the example printed "Arguments: undefined". - anthropic-integration: claude-haiku-4-5-20241022 is not a model id; the Claude Haiku 4.5 id is claude-haiku-4-5-20251001. - claude-agent-sdk-integration: a headless query cannot answer a permission prompt, so the StackOne MCP tools are now listed in allowedTools and actually run. Co-Authored-By: Claude Opus 5.5 Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com> --- README.md | 3 ++- examples/ai-sdk-integration.ts | 2 +- examples/anthropic-integration.ts | 2 +- examples/claude-agent-sdk-integration.ts | 2 ++ examples/openai-responses-integration.ts | 3 ++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 30ab93e8..534f8d50 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ await openai.responses.create({ model: 'gpt-5.1', instructions: 'You are a helpful HR assistant.', input: 'What is the phone number for employee c28xIQ?', - tools: tools.toOpenAIResponses(), + tools: tools.toOpenAIResponses({ strict: false }), }); ``` @@ -280,6 +280,7 @@ const result = query({ model: 'claude-sonnet-4-5-20250929', mcpServers: { 'stackone-tools': mcpServer }, tools: [], // Disable built-in tools + allowedTools: ['mcp__stackone-tools'], // Run the StackOne tools without a permission prompt maxTurns: 3, }, }); diff --git a/examples/ai-sdk-integration.ts b/examples/ai-sdk-integration.ts index be312b07..b00f31b0 100644 --- a/examples/ai-sdk-integration.ts +++ b/examples/ai-sdk-integration.ts @@ -57,7 +57,7 @@ const aiSdkIntegration = async (): Promise => { if (step.toolCalls.length > 0) { for (const toolCall of step.toolCalls) { console.log(` Tool call: ${toolCall.toolName}`); - console.log(` Arguments: ${JSON.stringify((toolCall as Record).args)}`); + console.log(` Arguments: ${JSON.stringify(toolCall.input)}`); } } } diff --git a/examples/anthropic-integration.ts b/examples/anthropic-integration.ts index 61762159..84fbdf89 100644 --- a/examples/anthropic-integration.ts +++ b/examples/anthropic-integration.ts @@ -34,7 +34,7 @@ const anthropicIntegration = async (): Promise => { // Create a message with tool calls const response = await anthropic.messages.create({ - model: 'claude-haiku-4-5-20241022', + model: 'claude-haiku-4-5-20251001', max_tokens: 1024, system: 'You are a helpful assistant that can access tools.', messages: [ diff --git a/examples/claude-agent-sdk-integration.ts b/examples/claude-agent-sdk-integration.ts index 28d13d97..01eedf3f 100644 --- a/examples/claude-agent-sdk-integration.ts +++ b/examples/claude-agent-sdk-integration.ts @@ -45,6 +45,8 @@ const claudeAgentSdkIntegration = async (): Promise => { }, // Disable built-in tools, only use our custom tools tools: [], + // Run the StackOne tools without a permission prompt, which a headless query cannot answer + allowedTools: ['mcp__stackone-tools'], maxTurns: 3, }, }); diff --git a/examples/openai-responses-integration.ts b/examples/openai-responses-integration.ts index 09536b50..fd99283b 100644 --- a/examples/openai-responses-integration.ts +++ b/examples/openai-responses-integration.ts @@ -26,7 +26,8 @@ const openaiResponsesIntegration = async (): Promise => { const tools = await toolset.fetchTools({ actions: ['*_list_*'], }); - const openAIResponsesTools = tools.toOpenAIResponses(); + // OpenAI's strict mode rejects schemas with optional fields, which most StackOne actions have + const openAIResponsesTools = tools.toOpenAIResponses({ strict: false }); console.log(`Loaded ${openAIResponsesTools.length} tools for OpenAI Responses API`); // Initialize OpenAI client From 3f0af152830a5d9f354b426369e08e493c26cd54 Mon Sep 17 00:00:00 2001 From: S2D2 Date: Wed, 11 Nov 2026 01:35:22 +0000 Subject: [PATCH 2/3] fix(examples): scope the auto-approved Claude Agent SDK example to list actions allowedTools runs every tool on the StackOne server without a prompt, so the example and README now fetch only the list actions the prompt needs rather than every action, writes included. The README Anthropic snippet also gets the Claude Haiku 4.5 id the example already uses. Co-Authored-By: Claude Opus 5.5 Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com> --- README.md | 5 +++-- examples/claude-agent-sdk-integration.ts | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 534f8d50..eb76bd03 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ const tools = await toolset.fetchTools(); const anthropic = new Anthropic(); await anthropic.messages.create({ - model: 'claude-haiku-4-5-20241022', + model: 'claude-haiku-4-5-20251001', max_tokens: 1024, system: 'You are a helpful HR assistant.', messages: [ @@ -270,7 +270,8 @@ import { StackOneToolSet } from '@stackone/ai'; const toolset = new StackOneToolSet({ accountId: process.env.STACKONE_ACCOUNT_ID || undefined }); // Fetch tools and convert to Claude Agent SDK format -const tools = await toolset.fetchTools(); +// Only the read actions the agent needs: allowedTools below runs them without asking +const tools = await toolset.fetchTools({ actions: ['*_list_*'] }); const mcpServer = await tools.toClaudeAgentSdk(); // Use with Claude Agent SDK query diff --git a/examples/claude-agent-sdk-integration.ts b/examples/claude-agent-sdk-integration.ts index 01eedf3f..1ee48be5 100644 --- a/examples/claude-agent-sdk-integration.ts +++ b/examples/claude-agent-sdk-integration.ts @@ -28,8 +28,8 @@ const claudeAgentSdkIntegration = async (): Promise => { const accountId = process.env.STACKONE_ACCOUNT_ID; const toolset = new StackOneToolSet({ accountId: accountId === '' ? undefined : accountId }); - // Fetch tools from StackOne and convert to Claude Agent SDK format - const tools = await toolset.fetchTools(); + // Fetch only the read actions the agent needs, since allowedTools below runs them without asking + const tools = await toolset.fetchTools({ actions: ['*_list_*'] }); const mcpServer = await tools.toClaudeAgentSdk(); console.log('Claude Agent SDK MCP server created'); From 63112c48d42a33ff1d068875a68be7a983269585 Mon Sep 17 00:00:00 2001 From: S2D2 Date: Thu, 12 Nov 2026 03:14:06 +0000 Subject: [PATCH 3/3] docs(examples): drop strict:false now that toOpenAIResponses defaults to non-strict #408 made toOpenAIResponses non-strict by default, so passing it and explaining that strict mode rejects optional fields is redundant. Co-Authored-By: Claude Opus 5.5 Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com> --- README.md | 2 +- examples/openai-responses-integration.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index de80ffff..db403f20 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ await openai.responses.create({ model: 'gpt-5.1', instructions: 'You are a helpful HR assistant.', input: 'What is the phone number for employee c28xIQ?', - tools: tools.toOpenAIResponses({ strict: false }), + tools: tools.toOpenAIResponses(), }); ``` diff --git a/examples/openai-responses-integration.ts b/examples/openai-responses-integration.ts index fd99283b..09536b50 100644 --- a/examples/openai-responses-integration.ts +++ b/examples/openai-responses-integration.ts @@ -26,8 +26,7 @@ const openaiResponsesIntegration = async (): Promise => { const tools = await toolset.fetchTools({ actions: ['*_list_*'], }); - // OpenAI's strict mode rejects schemas with optional fields, which most StackOne actions have - const openAIResponsesTools = tools.toOpenAIResponses({ strict: false }); + const openAIResponsesTools = tools.toOpenAIResponses(); console.log(`Loaded ${openAIResponsesTools.length} tools for OpenAI Responses API`); // Initialize OpenAI client