# InlineToolSchema

Class to define a Tool Schema from an inline string.

The schema can be provided directly as a string in either JSON or YAML format.

Extends: [ToolSchema](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.ToolSchema.html) › InlineToolSchema
Obtainable from: [ToolSchema.fromInline](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.ToolSchema.html#frominline)

- Source: [`lib/gateway/targets/schema/tool-schema.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-bedrock-agentcore-alpha/lib/gateway/targets/schema/tool-schema.ts#L265)

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';

declare const schemaDefinition_: bedrock_agentcore_alpha.SchemaDefinition;
const inlineToolSchema = new bedrock_agentcore_alpha.InlineToolSchema([{
  description: 'description',
  inputSchema: {
    type: bedrock_agentcore_alpha.SchemaDefinitionType.STRING,

    // the properties below are optional
    description: 'description',
    items: schemaDefinition_,
    properties: {
      propertiesKey: schemaDefinition_,
    },
    required: ['required'],
  },
  name: 'name',

  // the properties below are optional
  outputSchema: {
    type: bedrock_agentcore_alpha.SchemaDefinitionType.STRING,

    // the properties below are optional
    description: 'description',
    items: schemaDefinition_,
    properties: {
      propertiesKey: schemaDefinition_,
    },
    required: ['required'],
  },
}]);
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_bedrock_agentcore_alpha as bedrock_agentcore_alpha

# schema_definition_: bedrock_agentcore_alpha.SchemaDefinition

inline_tool_schema = bedrock_agentcore_alpha.InlineToolSchema([bedrock_agentcore_alpha.ToolDefinition(
    description="description",
    input_schema=bedrock_agentcore_alpha.SchemaDefinition(
        type=bedrock_agentcore_alpha.SchemaDefinitionType.STRING,

        # the properties below are optional
        description="description",
        items=schema_definition_,
        properties={
            "properties_key": schema_definition_
        },
        required=["required"]
    ),
    name="name",

    # the properties below are optional
    output_schema=bedrock_agentcore_alpha.SchemaDefinition(
        type=bedrock_agentcore_alpha.SchemaDefinitionType.STRING,

        # the properties below are optional
        description="description",
        items=schema_definition_,
        properties={
            "properties_key": schema_definition_
        },
        required=["required"]
    )
)])
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.agentcore.alpha.*;

SchemaDefinition schemaDefinition_;

InlineToolSchema inlineToolSchema = new InlineToolSchema(List.of(ToolDefinition.builder()
        .description("description")
        .inputSchema(SchemaDefinition.builder()
                .type(SchemaDefinitionType.STRING)

                // the properties below are optional
                .description("description")
                .items(schemaDefinition_)
                .properties(Map.of(
                        "propertiesKey", schemaDefinition_))
                .required(List.of("required"))
                .build())
        .name("name")

        // the properties below are optional
        .outputSchema(SchemaDefinition.builder()
                .type(SchemaDefinitionType.STRING)

                // the properties below are optional
                .description("description")
                .items(schemaDefinition_)
                .properties(Map.of(
                        "propertiesKey", schemaDefinition_))
                .required(List.of("required"))
                .build())
        .build()));
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Bedrock.Agentcore.Alpha;

SchemaDefinition schemaDefinition_;

var inlineToolSchema = new InlineToolSchema(new [] { new ToolDefinition {
    Description = "description",
    InputSchema = new SchemaDefinition {
        Type = SchemaDefinitionType.STRING,

        // the properties below are optional
        Description = "description",
        Items = schemaDefinition_,
        Properties = new Dictionary<string, SchemaDefinition> {
            { "propertiesKey", schemaDefinition_ }
        },
        Required = new [] { "required" }
    },
    Name = "name",

    // the properties below are optional
    OutputSchema = new SchemaDefinition {
        Type = SchemaDefinitionType.STRING,

        // the properties below are optional
        Description = "description",
        Items = schemaDefinition_,
        Properties = new Dictionary<string, SchemaDefinition> {
            { "propertiesKey", schemaDefinition_ }
        },
        Required = new [] { "required" }
    }
} });
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awsbedrockagentcorealpha"

var schemaDefinition_ SchemaDefinition

inlineToolSchema := bedrock_agentcore_alpha.NewInlineToolSchema([]ToolDefinition{
	&ToolDefinition{
		Description: jsii.String("description"),
		InputSchema: &SchemaDefinition{
			Type: bedrock_agentcore_alpha.SchemaDefinitionType_STRING,

			// the properties below are optional
			Description: jsii.String("description"),
			Items: schemaDefinition_,
			Properties: map[string]SchemaDefinition{
				"propertiesKey": schemaDefinition_,
			},
			Required: []*string{
				jsii.String("required"),
			},
		},
		Name: jsii.String("name"),

		// the properties below are optional
		OutputSchema: &SchemaDefinition{
			Type: bedrock_agentcore_alpha.SchemaDefinitionType_STRING,

			// the properties below are optional
			Description: jsii.String("description"),
			Items: schemaDefinition_,
			Properties: map[string]SchemaDefinition{
				"propertiesKey": schemaDefinition_,
			},
			Required: []*string{
				jsii.String("required"),
			},
		},
	},
})
```

## Initializer

TypeScript:

```ts
new InlineToolSchema(schema: ToolDefinition[])
```

Python:

```python
InlineToolSchema(schema: typing.List[ToolDefinition])
```

Java:

```java
new InlineToolSchema(List<ToolDefinition> schema)
```

C# / .NET:

```csharp
new InlineToolSchema(ToolDefinition[] schema)
```

Golang:

```go
NewInlineToolSchema(Schema *[]ToolDefinition)
```

## Properties

- `bucketOwnerAccountId`: string — The account ID of the S3 bucket owner for cross-account access.

- `inlineSchema`: [ToolDefinition](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.ToolDefinition.html)[] — The inline tool schema definition as a string, if using an inline schema.

  Can be in JSON or YAML format.

- `s3File`: [Location](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Location.html) — The S3 location of the tool schema file, if using an S3-based schema.

  Contains the bucket name and object key information.

## Methods

- `bind(scope: Construct): void` — Bind the schema to a construct.

- `fromInline(schema: ToolDefinition[]): InlineToolSchema // chainable` (static) — Creates a Tool Schema from an inline string.

  **Parameters**

  - `schema` — - the JSON or YAML payload defining the OpenAPI schema for the action group.

- `fromLocalAsset(path: string): ToolSchema` (static) — Creates a tool Schema from a local file.

  **Parameters**

  - `path` — - the path to the local file containing the function schema for the tool.

- `fromS3File(bucket: IBucket, objectKey: string, bucketOwnerAccountId?: string): S3ToolSchema` (static) — Creates a Tool Schema from an S3 File.

  **Parameters**

  - `bucket` — - the bucket containing the local file containing the OpenAPI schema for the action group.
  - `objectKey` — - object key in the bucket.
  - `bucketOwnerAccountId` — - optional The account ID of the Amazon S3 bucket owner.

- `grantPermissionsToRole(_role: IRole): void` — Grant permissions to the role.
