Files
anthropic-client/docs/api/AnthropicClient.Models.Tool.html
T

715 lines
28 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class Tool | AnthropicClient </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class Tool | AnthropicClient ">
<meta name="description" content="Represents a tool that can be used.">
<link rel="icon" href="../favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="docfx:docurl" content="https://github.com/StevanFreeborn/anthropic-client/new/stevanfreeborn/chore/add-workflows/apiSpec/new?filename=AnthropicClient_Models_Tool.md&amp;value=---%0Auid%3A%20AnthropicClient.Models.Tool%0Asummary%3A%20&#39;*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax&#39;%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="AnthropicClient">
AnthropicClient
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled="" placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="AnthropicClient.Models.Tool">
<h1 id="AnthropicClient_Models_Tool" data-uid="AnthropicClient.Models.Tool" class="text-break">
Class Tool <a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L34"><i class="bi bi-code-slash"></i></a>
</h1>
<div class="facts text-secondary">
<dl><dt>Namespace</dt><dd><a class="xref" href="AnthropicClient.html">AnthropicClient</a>.<a class="xref" href="AnthropicClient.Models.html">Models</a></dd></dl>
<dl><dt>Assembly</dt><dd>AnthropicClient.dll</dd></dl>
</div>
<div class="markdown summary"><p>Represents a tool that can be used.</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class Tool</code></pre>
</div>
<dl class="typelist inheritance">
<dt>Inheritance</dt>
<dd>
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
<div><span class="xref">Tool</span></div>
</dd>
</dl>
<dl class="typelist inheritedMembers">
<dt>Inherited Members</dt>
<dd>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
</div>
</dd></dl>
<h2 class="section" id="properties">Properties
</h2>
<a id="AnthropicClient_Models_Tool_Description_" data-uid="AnthropicClient.Models.Tool.Description*"></a>
<h3 id="AnthropicClient_Models_Tool_Description" data-uid="AnthropicClient.Models.Tool.Description">
Description
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L44"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets the description of the tool.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public string Description { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_Tool_DisplayName_" data-uid="AnthropicClient.Models.Tool.DisplayName*"></a>
<h3 id="AnthropicClient_Models_Tool_DisplayName" data-uid="AnthropicClient.Models.Tool.DisplayName">
DisplayName
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L61"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets the display name of the tool.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[JsonIgnore]
public string DisplayName { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_Tool_Function_" data-uid="AnthropicClient.Models.Tool.Function*"></a>
<h3 id="AnthropicClient_Models_Tool_Function" data-uid="AnthropicClient.Models.Tool.Function">
Function
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L55"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets the function of the tool.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[JsonIgnore]
public AnthropicFunction Function { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="AnthropicClient.Models.AnthropicFunction.html">AnthropicFunction</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_Tool_InputSchema_" data-uid="AnthropicClient.Models.Tool.InputSchema*"></a>
<h3 id="AnthropicClient_Models_Tool_InputSchema" data-uid="AnthropicClient.Models.Tool.InputSchema">
InputSchema
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L49"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets the input schema of the tool.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">[JsonPropertyName(&quot;input_schema&quot;)]
public JsonObject InputSchema { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.text.json.nodes.jsonobject">JsonObject</a></dt>
<dd></dd>
</dl>
<a id="AnthropicClient_Models_Tool_Name_" data-uid="AnthropicClient.Models.Tool.Name*"></a>
<h3 id="AnthropicClient_Models_Tool_Name" data-uid="AnthropicClient.Models.Tool.Name">
Name
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L39"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Gets the name of the tool. This name will conform to the Anthropic tool naming rules.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public string Name { get; }</code></pre>
</div>
<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<h2 class="section" id="methods">Methods
</h2>
<a id="AnthropicClient_Models_Tool_CreateFromClass_" data-uid="AnthropicClient.Models.Tool.CreateFromClass*"></a>
<h3 id="AnthropicClient_Models_Tool_CreateFromClass__1" data-uid="AnthropicClient.Models.Tool.CreateFromClass``1">
CreateFromClass&lt;T&gt;()
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L102"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a tool from a type that implements <a class="xref" href="AnthropicClient.Models.ITool.html">ITool</a>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Tool CreateFromClass&lt;T&gt;() where T : ITool, new()</code></pre>
</div>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a></dt>
<dd><p>The created tool as instance of <a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a>.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>T</code></dt>
<dd><p>The type that implements <a class="xref" href="AnthropicClient.Models.ITool.html">ITool</a>.</p>
</dd>
</dl>
<h4 class="section" id="AnthropicClient_Models_Tool_CreateFromClass__1_remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>The implementation of <a class="xref" href="AnthropicClient.Models.ITool.html">ITool</a> must have a parameterless constructor.</p>
</div>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
<dd><p>Thrown when the name or description of the tool is null or empty.</p>
</dd>
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
<dd><p>Thrown when the function of the tool is null.</p>
</dd>
</dl>
<a id="AnthropicClient_Models_Tool_CreateFromFunction_" data-uid="AnthropicClient.Models.Tool.CreateFromFunction*"></a>
<h3 id="AnthropicClient_Models_Tool_CreateFromFunction__1_System_String_System_String_System_Func___0__" data-uid="AnthropicClient.Models.Tool.CreateFromFunction``1(System.String,System.String,System.Func{``0})">
CreateFromFunction&lt;TResult&gt;(string, string, Func&lt;TResult&gt;)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L177"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a tool from a function.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Tool CreateFromFunction&lt;TResult&gt;(string name, string description, Func&lt;TResult&gt; func)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>name</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The name of the tool.</p>
</dd>
<dt><code>description</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The description of the tool.</p>
</dd>
<dt><code>func</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-1">Func</a>&lt;TResult&gt;</dt>
<dd><p>The function.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a></dt>
<dd><p>The created tool as instance of <a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a>.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>TResult</code></dt>
<dd><p>The type of the result for the delegate.</p>
</dd>
</dl>
<h4 class="section" id="AnthropicClient_Models_Tool_CreateFromFunction__1_System_String_System_String_System_Func___0___remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</p>
</div>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
<dd><p>Thrown when <code class="paramref">func</code> is null.</p>
</dd>
</dl>
<a id="AnthropicClient_Models_Tool_CreateFromFunction_" data-uid="AnthropicClient.Models.Tool.CreateFromFunction*"></a>
<h3 id="AnthropicClient_Models_Tool_CreateFromFunction__2_System_String_System_String_System_Func___0___1__" data-uid="AnthropicClient.Models.Tool.CreateFromFunction``2(System.String,System.String,System.Func{``0,``1})">
CreateFromFunction&lt;T1, TResult&gt;(string, string, Func&lt;T1, TResult&gt;)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L195"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a tool from a function.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Tool CreateFromFunction&lt;T1, TResult&gt;(string name, string description, Func&lt;T1, TResult&gt; func)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>name</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The name of the tool.</p>
</dd>
<dt><code>description</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The description of the tool.</p>
</dd>
<dt><code>func</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-2">Func</a>&lt;T1, TResult&gt;</dt>
<dd><p>The function.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a></dt>
<dd><p>The created tool as instance of <a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a>.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>T1</code></dt>
<dd><p>The type of the first parameter for the delegate.</p>
</dd>
<dt><code>TResult</code></dt>
<dd><p>The type of the result for the delegate.</p>
</dd>
</dl>
<h4 class="section" id="AnthropicClient_Models_Tool_CreateFromFunction__2_System_String_System_String_System_Func___0___1___remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</p>
</div>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
<dd><p>Thrown when <code class="paramref">func</code> is null.</p>
</dd>
</dl>
<a id="AnthropicClient_Models_Tool_CreateFromFunction_" data-uid="AnthropicClient.Models.Tool.CreateFromFunction*"></a>
<h3 id="AnthropicClient_Models_Tool_CreateFromFunction__3_System_String_System_String_System_Func___0___1___2__" data-uid="AnthropicClient.Models.Tool.CreateFromFunction``3(System.String,System.String,System.Func{``0,``1,``2})">
CreateFromFunction&lt;T1, T2, TResult&gt;(string, string, Func&lt;T1, T2, TResult&gt;)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L214"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a tool from a function.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Tool CreateFromFunction&lt;T1, T2, TResult&gt;(string name, string description, Func&lt;T1, T2, TResult&gt; func)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>name</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The name of the tool.</p>
</dd>
<dt><code>description</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The description of the tool.</p>
</dd>
<dt><code>func</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.func-3">Func</a>&lt;T1, T2, TResult&gt;</dt>
<dd><p>The function.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a></dt>
<dd><p>The created tool as instance of <a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a>.</p>
</dd>
</dl>
<h4 class="section">Type Parameters</h4>
<dl class="parameters">
<dt><code>T1</code></dt>
<dd><p>The type of the first parameter for the delegate.</p>
</dd>
<dt><code>T2</code></dt>
<dd><p>The type of the second parameter for the delegate.</p>
</dd>
<dt><code>TResult</code></dt>
<dd><p>The type of the result for the delegate.</p>
</dd>
</dl>
<h4 class="section" id="AnthropicClient_Models_Tool_CreateFromFunction__3_System_String_System_String_System_Func___0___1___2___remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</p>
</div>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
<dd><p>Thrown when <code class="paramref">func</code> is null.</p>
</dd>
</dl>
<a id="AnthropicClient_Models_Tool_CreateFromInstanceMethod_" data-uid="AnthropicClient.Models.Tool.CreateFromInstanceMethod*"></a>
<h3 id="AnthropicClient_Models_Tool_CreateFromInstanceMethod_System_String_System_String_System_Object_System_String_" data-uid="AnthropicClient.Models.Tool.CreateFromInstanceMethod(System.String,System.String,System.Object,System.String)">
CreateFromInstanceMethod(string, string, object, string)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L152"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a tool from an instance method.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Tool CreateFromInstanceMethod(string name, string description, object instance, string methodName)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>name</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The name of the tool.</p>
</dd>
<dt><code>description</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The description of the tool.</p>
</dd>
<dt><code>instance</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></dt>
<dd><p>The instance that contains the method.</p>
</dd>
<dt><code>methodName</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The name of the method.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a></dt>
<dd><p>The created tool as instance of <a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a>.</p>
</dd>
</dl>
<h4 class="section" id="AnthropicClient_Models_Tool_CreateFromInstanceMethod_System_String_System_String_System_Object_System_String__remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</p>
</div>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
<dd><p>Thrown when <code class="paramref">methodName</code> is null or empty.</p>
</dd>
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
<dd><p>Thrown when <code class="paramref">instance</code> is null.</p>
</dd>
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
<dd><p>Thrown when <code class="paramref">methodName</code> is not found in the type of <code class="paramref">instance</code>.</p>
</dd>
</dl>
<a id="AnthropicClient_Models_Tool_CreateFromStaticMethod_" data-uid="AnthropicClient.Models.Tool.CreateFromStaticMethod*"></a>
<h3 id="AnthropicClient_Models_Tool_CreateFromStaticMethod_System_String_System_String_System_Type_System_String_" data-uid="AnthropicClient.Models.Tool.CreateFromStaticMethod(System.String,System.String,System.Type,System.String)">
CreateFromStaticMethod(string, string, Type, string)
<a class="header-action link-secondary" title="View source" href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L125"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Creates a tool from a static method.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static Tool CreateFromStaticMethod(string name, string description, Type type, string methodName)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>name</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The name of the tool.</p>
</dd>
<dt><code>description</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The description of the tool.</p>
</dd>
<dt><code>type</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.type">Type</a></dt>
<dd><p>The type that contains the method.</p>
</dd>
<dt><code>methodName</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd><p>The name of the method.</p>
</dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a></dt>
<dd><p>The created tool as instance of <a class="xref" href="AnthropicClient.Models.Tool.html">Tool</a>.</p>
</dd>
</dl>
<h4 class="section" id="AnthropicClient_Models_Tool_CreateFromStaticMethod_System_String_System_String_System_Type_System_String__remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>The name of the tool will be sanitized to conform to the Anthropic tool naming rules.</p>
</div>
<h4 class="section">Exceptions</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
<dd><p>Thrown when <code class="paramref">methodName</code> is null or empty.</p>
</dd>
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentnullexception">ArgumentNullException</a></dt>
<dd><p>Thrown when <code class="paramref">type</code> is null.</p>
</dd>
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.argumentexception">ArgumentException</a></dt>
<dd><p>Thrown when the method is not found in the type.</p>
</dd>
</dl>
</article>
<div class="contribution d-print-none">
<a href="https://github.com/StevanFreeborn/anthropic-client/blob/stevanfreeborn/chore/add-workflows/src/AnthropicClient/Models/Tool.cs/#L34" class="edit-link">Edit this page</a>
</div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span>Made with <a href="https://dotnet.github.io/docfx">docfx</a></span>
</div>
</div>
</footer>
</body>
</html>