Tool Class

A tool registered by a document and exposed to another document, or to the application (https://webmachinelearning.github.io/webmcp/#tool-interface, as defined by webmachinelearning/webmcp#348, which replaces the RegisteredTool dictionary): a snapshot of the tool when ModelContext.GetTools or BrowsingContext.GetModelContextTools discovered it, which identifies this registration of the tool: once the tool is unregistered, it cannot be executed anymore, even when a tool with the same name is registered again.

public sealed class Tool

Properties

NameDescription
AnnotationsGets the annotations of the tool as a value for the scripts (a JavaScript object, created by the script engine once), or null when the tool was registered without annotations. The .NET code reads Tool.ToolAnnotations.
DescriptionGets the natural language description of the tool.
DocumentGets the document that registered the tool.
InputSchemaGets the JSON Schema of the input arguments as a value for the scripts (a JavaScript object, parsed by the script engine once), or null. The .NET code reads Tool.InputSchemaJson.
InputSchemaJsonGets the JSON Schema of the input arguments, as JSON text, or null when the tool was registered without one.
NameGets the name of the tool.
OriginGets the serialization of the origin of the document that registered the tool (null for an opaque origin).
OutputSchemaGets the JSON Schema of the result as a value for the scripts (a JavaScript object, parsed by the script engine once), or null. The .NET code reads Tool.OutputSchemaJson.
OutputSchemaJsonGets the JSON Schema of the result, as JSON text, or null when the tool was registered without one.
TitleGets the human-readable title of the tool, or the empty string when it has none.
ToolAnnotationsGets the annotations of the tool, or null when the tool was registered without annotations.
WindowGets the window of the document that registered the tool, or null when its browsing context was destroyed (e.g. its iframe was removed).

Gets the annotations of the tool as a value for the scripts (a JavaScript object, created by the script engine once), or null when the tool was registered without annotations. The .NET code reads Tool.ToolAnnotations.

public object? Annotations { get; }

Gets the natural language description of the tool.

public string Description { get; }

Gets the document that registered the tool.

public Document Document { get; }

Property value

Document

Gets the JSON Schema of the input arguments as a value for the scripts (a JavaScript object, parsed by the script engine once), or null. The .NET code reads Tool.InputSchemaJson.

public object? InputSchema { get; }

InputSchemaJson

ModelContextTypes.cs

Gets the JSON Schema of the input arguments, as JSON text, or null when the tool was registered without one.

public string? InputSchemaJson { get; }

Property value

string?

Gets the name of the tool.

public string Name { get; }

Gets the serialization of the origin of the document that registered the tool (null for an opaque origin).

public string Origin { get; }

Gets the JSON Schema of the result as a value for the scripts (a JavaScript object, parsed by the script engine once), or null. The .NET code reads Tool.OutputSchemaJson.

public object? OutputSchema { get; }

OutputSchemaJson

ModelContextTypes.cs

Gets the JSON Schema of the result, as JSON text, or null when the tool was registered without one.

public string? OutputSchemaJson { get; }

Property value

string?

Gets the human-readable title of the tool, or the empty string when it has none.

public string Title { get; }

ToolAnnotations

ModelContextTypes.cs

Gets the annotations of the tool, or null when the tool was registered without annotations.

public ToolAnnotations? ToolAnnotations { get; }

Property value

ToolAnnotations?

Gets the window of the document that registered the tool, or null when its browsing context was destroyed (e.g. its iframe was removed).

public Window? Window { get; }

Methods

NameDescription
ToString()Returns a string that represents the current object.

Returns a string that represents the current object.

public override string ToString()

Returns

string A string that represents the current object.