# SchemaDefinition

Schema definition for tool input/output.

- Source: [`aws-bedrockagentcore/lib/gateway/targets/schema/tool-schema.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/gateway/targets/schema/tool-schema.ts#L72)
- Type last changed: v2.255.0 · 19 May 2026

## Example

```ts
// Create a gateway first
const gateway = new agentcore.Gateway(this, "MyGateway", {
  gatewayName: "my-gateway",
});

const lambdaFunction = new lambda.Function(this, "MyFunction", {
  runtime: lambda.Runtime.NODEJS_22_X,
  handler: "index.handler",
  code: lambda.Code.fromInline(`
    exports.handler = async (event) => {
      return {
        statusCode: 200,
        body: JSON.stringify({ message: 'Hello from Lambda!' })
      };
    };
  `),
});

const lambdaTarget = gateway.addLambdaTarget("MyLambdaTarget", {
  gatewayTargetName: "my-lambda-target",
  description: "Lambda function target",
  lambdaFunction: lambdaFunction,
  toolSchema: agentcore.ToolSchema.fromInline([
    {
      name: "hello_world",
      description: "A simple hello world tool",
      inputSchema: {
        type: agentcore.SchemaDefinitionType.OBJECT,
        properties: {
          name: {
            type: agentcore.SchemaDefinitionType.STRING,
            description: "The name to greet",
          },
        },
        required: ["name"],
      },
    },
  ]),
});
```

## Properties

- `description`: string — The description of the schema definition.

  **Default:** No description

  This description provides information about the purpose and usage of the schema.

- `items`: [SchemaDefinition](/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.SchemaDefinition.html) — The items in the schema definition.

  **Default:** No items definition

  This field is used for array types to define the structure of the array elements.

- `properties`: { [key: string]: [SchemaDefinition](/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.SchemaDefinition.html) } — The properties of the schema definition.

  **Default:** No properties

  These properties define the fields in the schema.

- `required`: string[] — The required fields in the schema definition.

  **Default:** No required fields

  These fields must be provided when using the schema.

- `type`: [SchemaDefinitionType](/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.SchemaDefinitionType.html) (required) — The type of the schema definition.

  This field specifies the data type of the schema.
