SchemaDefinition
- class aws_cdk.aws_bedrockagentcore.SchemaDefinition(*, type, description=None, items=None, properties=None, required=None)
Bases:
objectSchema definition for tool input/output.
- Parameters:
type (
SchemaDefinitionType) – The type of the schema definition. This field specifies the data type of the schema.description (
Optional[str]) – The description of the schema definition. This description provides information about the purpose and usage of the schema. Default: - No descriptionitems (
Union[SchemaDefinition,Dict[str,Any],None]) – The items in the schema definition. This field is used for array types to define the structure of the array elements. Default: - No items definitionproperties (
Optional[Mapping[str,Union[SchemaDefinition,Dict[str,Any]]]]) – The properties of the schema definition. These properties define the fields in the schema. Default: - No propertiesrequired (
Optional[Sequence[str]]) – The required fields in the schema definition. These fields must be provided when using the schema. Default: - No required fields
- ExampleMetadata:
fixture=default infused
Example:
# Create a gateway first gateway = agentcore.Gateway(self, "MyGateway", gateway_name="my-gateway" ) lambda_function = lambda_.Function(self, "MyFunction", runtime=lambda_.Runtime.NODEJS_22_X, handler="index.handler", code=lambda_.Code.from_inline(""" exports.handler = async (event) => { return { statusCode: 200, body: JSON.stringify({ message: 'Hello from Lambda!' }) }; }; """) ) lambda_target = gateway.add_lambda_target("MyLambdaTarget", gateway_target_name="my-lambda-target", description="Lambda function target", lambda_function=lambda_function, tool_schema=agentcore.ToolSchema.from_inline([ name="hello_world", description="A simple hello world tool", input_schema=agentcore.SchemaDefinition( type=agentcore.SchemaDefinitionType.OBJECT, properties={ "name": agentcore.SchemaDefinition( type=agentcore.SchemaDefinitionType.STRING, description="The name to greet" ) }, required=["name"] ) ]) )
Attributes
- description
The description of the schema definition.
This description provides information about the purpose and usage of the schema.
- Default:
No description
- items
The items in the schema definition.
This field is used for array types to define the structure of the array elements.
- Default:
No items definition
- properties
The properties of the schema definition.
These properties define the fields in the schema.
- Default:
No properties
- required
The required fields in the schema definition.
These fields must be provided when using the schema.
- Default:
No required fields
- type
The type of the schema definition.
This field specifies the data type of the schema.