Table of Contents

Class ClaudeToolAttribute

Namespace
Emissary
Assembly
Emissary.dll

Marks a static method as a Claude tool. The Emissary source generator turns it into a ToolDefinition exposed as a generated {MethodName}Tool property on the containing type — with a compile-time JSON Schema and a reflection-free dispatcher.

[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
public sealed class ClaudeToolAttribute : Attribute
Inheritance
ClaudeToolAttribute
Inherited Members

Remarks

The containing type (and any types it is nested in) must be declared partial.

Properties

CompensatedBy

Names another [ClaudeTool] method on the same type that undoes this tool's effect (saga compensation), e.g. CompensatedBy = nameof(CancelReservation). The compensator is invoked with this tool's original input by CompensateAsync(AgentResult, CancellationToken).

public string? CompensatedBy { get; set; }

Property Value

string

Description

The tool description shown to the model. A missing description raises diagnostic EMS001 — Claude picks tools by their descriptions, so an empty one is almost always a bug.

public string? Description { get; set; }

Property Value

string

MaxResultLength

Caps how many characters of this tool's output reach the model, guarding the context window and token budget against a tool that returns far more than expected. Output past the cap is replaced with a notice telling the model data was withheld. Leave at 0 (the default) for no cap; negative values raise diagnostic EMS011.

public int MaxResultLength { get; set; }

Property Value

int

Name

The wire name of the tool. Defaults to the snake_case form of the method name.

public string? Name { get; set; }

Property Value

string

Privileged

Marks the tool as privileged (payments, deletions, outbound messages...). Privileged tools are blocked for the rest of a run once any Untrusted tool output has entered the conversation.

public bool Privileged { get; set; }

Property Value

bool

Untrusted

Marks the tool's output as untrusted (web content, user documents, external email...). A successful call taints the rest of the run: Privileged tools are then blocked — the information-flow guard against prompt injection.

public bool Untrusted { get; set; }

Property Value

bool