@@ -110,32 +110,6 @@ export class BedrockAgentFunctionResolver {
110
110
* app.resolve(event, context);
111
111
* ```
112
112
*
113
- * The method also works as a class method decorator:
114
- *
115
- * @example
116
- * ```ts
117
- * import {
118
- * BedrockAgentFunctionResolver
119
- * } from '@aws-lambda-powertools/event-handler/bedrock-agent';
120
- *
121
- * const app = new BedrockAgentFunctionResolver();
122
- *
123
- * class Lambda {
124
- * @app .tool({ name: 'greeting', description: 'Greets a person by name' })
125
- * async greeting(params) {
126
- * const { name } = params;
127
- * return `Hello, ${name}!`;
128
- * }
129
- *
130
- * async handler(event, context) {
131
- * return app.resolve(event, context);
132
- * }
133
- * }
134
- *
135
- * const lambda = new Lambda();
136
- * export const handler = lambda.handler.bind(lambda);
137
- * ```
138
- *
139
113
* When defining a tool, you can also access the original `event` and `context` objects from the Bedrock Agent function invocation.
140
114
* This is useful if you need to access the session attributes or other context-specific information.
141
115
*
@@ -172,26 +146,9 @@ export class BedrockAgentFunctionResolver {
172
146
public tool < TParams extends Record < string , ParameterValue > > (
173
147
fn : ToolFunction < TParams > ,
174
148
config : Configuration
175
- ) : undefined ;
176
- public tool < TParams extends Record < string , ParameterValue > > (
177
- config : Configuration
178
- ) : MethodDecorator ;
179
- public tool < TParams extends Record < string , ParameterValue > > (
180
- fnOrConfig : ToolFunction < TParams > | Configuration ,
181
- config ?: Configuration
182
- ) : MethodDecorator | undefined {
183
- // When used as a method (not a decorator)
184
- if ( typeof fnOrConfig === 'function' ) {
185
- this . #registerTool( fnOrConfig , config as Configuration ) ;
186
- return ;
187
- }
188
-
189
- // When used as a decorator
190
- return ( _target , _propertyKey , descriptor : PropertyDescriptor ) => {
191
- const toolFn = descriptor . value as ToolFunction ;
192
- this . #registerTool( toolFn , fnOrConfig ) ;
193
- return descriptor ;
194
- } ;
149
+ ) : undefined {
150
+ this . #registerTool( fn , config ) ;
151
+ return ;
195
152
}
196
153
197
154
#registerTool< TParams extends Record < string , ParameterValue > > (
@@ -267,7 +224,7 @@ export class BedrockAgentFunctionResolver {
267
224
try {
268
225
const response = await tool . handler ( toolParams , { event, context } ) ;
269
226
if ( response instanceof BedrockFunctionResponse ) {
270
- const res = response . build ( {
227
+ return response . build ( {
271
228
actionGroup,
272
229
func : toolName ,
273
230
} ) ;
0 commit comments