# ToolApprovalContext

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.toolapprovalcontext/
> Summary: ToolApprovalContext: The tool call a code-defined approval policy judges. Read-only.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.Abstractions.dll</code></div>

The tool call a code-defined approval policy judges. Read-only.

```csharp
public sealed class ToolApprovalContext
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.toolapprovalcontext/">ToolApprovalContext</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

Registered with `ITraconBuilder.AddToolApprovalPolicy(toolName, policy)`
(`Tracon.Core`). A policy runs **before** the data rules
([ToolApprovalRule](/api/tracon.toolapprovalrule/)) and its decision, when not
[ToolApprovalPolicyDecision.Undecided](/api/tracon.toolapprovalpolicydecision/), overrides them — a policy is a
security boundary written in code, and data cannot loosen it.

## Constructors

### <a id="Tracon_ToolApprovalContext__ctor"></a> ToolApprovalContext\(\)

```csharp
public ToolApprovalContext()
```

## Properties

### <a id="Tracon_ToolApprovalContext_AgentName"></a> AgentName

Gets the agent making the call, when known.

```csharp
public string? AgentName { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)?

### <a id="Tracon_ToolApprovalContext_Arguments"></a> Arguments

Gets the call's arguments, keyed by parameter name.

```csharp
public required IReadOnlyDictionary<string, object?> Arguments { get; init; }
```

#### Property Value

 [IReadOnlyDictionary](https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlydictionary\-2)<[string](https://learn.microsoft.com/dotnet/api/system.string), [object](https://learn.microsoft.com/dotnet/api/system.object)?\>

### <a id="Tracon_ToolApprovalContext_TenantId"></a> TenantId

Gets the tenant making the call.

```csharp
public required string TenantId { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="Tracon_ToolApprovalContext_ToolName"></a> ToolName

Gets the tool being called.

```csharp
public required string ToolName { get; init; }
```

#### Property Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Methods

### <a id="Tracon_ToolApprovalContext_GetNumber_System_String_"></a> GetNumber\(string\)

Reads a number at a dotted path into [ToolApprovalContext.Arguments](/api/tracon.toolapprovalcontext/#Tracon_ToolApprovalContext_Arguments) (for example
`order.amount`). Returns [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if the path does not
resolve or the value is not a number.

```csharp
public double? GetNumber(string path)
```

#### Parameters

`path` [string](https://learn.microsoft.com/dotnet/api/system.string)

The dotted path. No array index is accepted.

#### Returns

 [double](https://learn.microsoft.com/dotnet/api/system.double)?

### <a id="Tracon_ToolApprovalContext_GetString_System_String_"></a> GetString\(string\)

Reads text at a dotted path into [ToolApprovalContext.Arguments](/api/tracon.toolapprovalcontext/#Tracon_ToolApprovalContext_Arguments) (for example
`customer.tier`). Returns [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if the path does not
resolve or the value is not text.

```csharp
public string? GetString(string path)
```

#### Parameters

`path` [string](https://learn.microsoft.com/dotnet/api/system.string)

The dotted path. No array index is accepted.

#### Returns

 [string](https://learn.microsoft.com/dotnet/api/system.string)?
