Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 17 additions & 21 deletions src/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5693,38 +5693,33 @@ Thumbs.db

exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/strands/base/main.ts should match snapshot 1`] = `
"import { BedrockAgentCoreApp } from 'bedrock-agentcore/runtime';
import { Agent, tool } from '@strands-agents/sdk';
import { Agent, McpClient, tool, type ToolList } from '@strands-agents/sdk';
import { z } from 'zod';
import { loadModel } from './model/load.js';
import { getStreamableHttpMcpClient } from './mcp_client/client.js';

// Define a collection of MCP clients
const mcpClients = [getStreamableHttpMcpClient()].filter(Boolean);
// Define a collection of MCP clients (filter out anything that failed to initialize)
const mcpClients: McpClient[] = [getStreamableHttpMcpClient()].filter(
(client): client is McpClient => Boolean(client)
);

// Define a collection of tools used by the model
const tools: unknown[] = [];
const tools: ToolList = [];

// Define a simple function tool
// Define a simple function tool — the Zod schema gives us type inference and runtime validation for free
const addNumbers = tool({
name: 'add_numbers',
description: 'Return the sum of two numbers',
inputSchema: {
type: 'object',
properties: {
a: { type: 'number' },
b: { type: 'number' },
},
required: ['a', 'b'],
},
callback: async ({ a, b }: { a: number; b: number }) => a + b,
inputSchema: z.object({
a: z.number(),
b: z.number(),
}),
callback: async ({ a, b }) => a + b,
});
tools.push(addNumbers);

// Add MCP clients to tools if available
for (const mcpClient of mcpClients) {
if (mcpClient) {
tools.push(mcpClient);
}
}
// Add MCP clients to tools
tools.push(...mcpClients);

const SYSTEM_PROMPT = \`
You are a helpful assistant. Use tools when appropriate.
Expand Down Expand Up @@ -5912,7 +5907,8 @@ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/
"@modelcontextprotocol/sdk": "^1.25.2",
"@strands-agents/sdk": "1.0.0-rc.4",
"bedrock-agentcore": "^0.2.4",
"tsx": "^4.19.0"
"tsx": "^4.19.0",
"zod": "^4.4.3"
},
"devDependencies": {
"@types/node": "^22.0.0",
Expand Down
35 changes: 15 additions & 20 deletions src/assets/typescript/http/strands/base/main.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
import { BedrockAgentCoreApp } from 'bedrock-agentcore/runtime';
import { Agent, tool } from '@strands-agents/sdk';
import { Agent, McpClient, tool, type ToolList } from '@strands-agents/sdk';
import { z } from 'zod';
import { loadModel } from './model/load.js';
import { getStreamableHttpMcpClient } from './mcp_client/client.js';

// Define a collection of MCP clients
const mcpClients = [getStreamableHttpMcpClient()].filter(Boolean);
// Define a collection of MCP clients (filter out anything that failed to initialize)
const mcpClients: McpClient[] = [getStreamableHttpMcpClient()].filter(
(client): client is McpClient => Boolean(client)
);

// Define a collection of tools used by the model
const tools: unknown[] = [];
const tools: ToolList = [];

// Define a simple function tool
// Define a simple function tool — the Zod schema gives us type inference and runtime validation for free
const addNumbers = tool({
name: 'add_numbers',
description: 'Return the sum of two numbers',
inputSchema: {
type: 'object',
properties: {
a: { type: 'number' },
b: { type: 'number' },
},
required: ['a', 'b'],
},
callback: async ({ a, b }: { a: number; b: number }) => a + b,
inputSchema: z.object({
a: z.number(),
b: z.number(),
}),
callback: async ({ a, b }) => a + b,
});
tools.push(addNumbers);

// Add MCP clients to tools if available
for (const mcpClient of mcpClients) {
if (mcpClient) {
tools.push(mcpClient);
}
}
// Add MCP clients to tools
tools.push(...mcpClients);

const SYSTEM_PROMPT = `
You are a helpful assistant. Use tools when appropriate.
Expand Down
3 changes: 2 additions & 1 deletion src/assets/typescript/http/strands/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"@modelcontextprotocol/sdk": "^1.25.2",
"@strands-agents/sdk": "1.0.0-rc.4",
"bedrock-agentcore": "^0.2.4",
"tsx": "^4.19.0"
"tsx": "^4.19.0",
"zod": "^4.4.3"
},
"devDependencies": {
"@types/node": "^22.0.0",
Expand Down
Loading