Skip to content

Commit e9407a6

Browse files
committed
deploy: 9a98f9c
1 parent 8cfda75 commit e9407a6

File tree

6 files changed

+59
-56
lines changed

6 files changed

+59
-56
lines changed

available-tools/index.html

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,14 @@
363363
<section id="mkdocs-terminal-content">
364364
<h1 id="available-tools">Available Tools<a class="headerlink" href="#available-tools" title="Anchor link to this section for reference">#</a></h1>
365365
<p>Get available tools from your StackOne organisation based on the account id.</p>
366-
<p>This example demonstrates different ways to filter and organize tools:
367-
1. Getting all available tools
368-
2. Filtering by vertical
369-
3. Using multiple patterns for cross-vertical functionality
370-
4. Filtering by specific operations
371-
5. Combining multiple operation patterns</p>
366+
<p>This example demonstrates different ways to filter and organize tools:</p>
367+
<ol>
368+
<li>Getting all available tools</li>
369+
<li>Filtering by vertical</li>
370+
<li>Using multiple patterns for cross-vertical functionality</li>
371+
<li>Filtering by specific operations</li>
372+
<li>Combining multiple operation patterns</li>
373+
</ol>
372374
<p>TODO: experimental - get_available_tools(account_id="your_account_id")</p>
373375
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>uv<span style="color: #A89028"> </span>run<span style="color: #A89028"> </span>examples/available_tools.py
374376
</code></pre></div>
@@ -381,17 +383,17 @@ <h1 id="available-tools">Available Tools<a class="headerlink" href="#available-t
381383

382384
<span style="color: #2838B0">def</span><span style="color: #A89028"> </span><span style="color: #785840">get_available_tools</span><span style="color: #888">()</span> <span style="color: #666">-&gt;</span> <span style="color: #444; font-style: italic">None</span><span style="color: #888">:</span>
383385
toolset <span style="color: #666">=</span> StackOneToolSet<span style="color: #888">()</span>
384-
385-
<span style="color: #888; font-style: italic"># First, get all tools</span>
386-
all_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">()</span>
386+
</code></pre></div>
387+
<p>We can get all tools using the <code>get_tools</code> method.</p>
388+
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>all_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">()</span>
387389
<span style="color: #2838B0">assert</span> <span style="color: #388038">len</span><span style="color: #888">(</span>all_tools<span style="color: #888">)</span> <span style="color: #666">&gt;</span> <span style="color: #444">100</span><span style="color: #888">,</span> <span style="color: #B83838">&quot;Expected at least 100 tools in total&quot;</span>
388-
389-
<span style="color: #888; font-style: italic"># Then, let&#39;s get just HRIS tools using a vertical filter</span>
390-
hris_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span><span style="color: #B83838">&quot;hris_*&quot;</span><span style="color: #888">)</span>
390+
</code></pre></div>
391+
<p>Then, let's get just HRIS tools using a filter. This filter accepts glob patterns.</p>
392+
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>hris_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span><span style="color: #B83838">&quot;hris_*&quot;</span><span style="color: #888">)</span>
391393
<span style="color: #2838B0">assert</span> <span style="color: #388038">len</span><span style="color: #888">(</span>hris_tools<span style="color: #888">)</span> <span style="color: #666">&gt;</span> <span style="color: #444">10</span><span style="color: #888">,</span> <span style="color: #B83838">&quot;Expected at least 10 HRIS tools&quot;</span>
392-
393-
<span style="color: #888; font-style: italic"># Now, let&#39;s get people-related tools across verticals</span>
394-
people_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span>
394+
</code></pre></div>
395+
<p>Filter with multiple patterns. This will return all tools that match either pattern (OR operator).</p>
396+
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>people_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span>
395397
<span style="color: #888">[</span>
396398
<span style="color: #B83838">&quot;hris_*employee*&quot;</span><span style="color: #888">,</span>
397399
<span style="color: #B83838">&quot;crm_*contact*&quot;</span><span style="color: #888">,</span>
@@ -402,21 +404,21 @@ <h1 id="available-tools">Available Tools<a class="headerlink" href="#available-t
402404
<span style="color: #2838B0">assert</span> <span style="color: #B83838">&quot;employee&quot;</span> <span style="color: #A848A8">in</span> tool<span style="color: #666">.</span>name <span style="color: #A848A8">or</span> <span style="color: #B83838">&quot;contact&quot;</span> <span style="color: #A848A8">in</span> tool<span style="color: #666">.</span>name<span style="color: #888">,</span> <span style="color: #888">(</span>
403405
<span style="color: #444">f</span><span style="color: #B83838">&quot;Tool </span><span style="color: #B83838; text-decoration: underline">{</span>tool<span style="color: #666">.</span>name<span style="color: #B83838; text-decoration: underline">}</span><span style="color: #B83838"> doesn&#39;t contain &#39;employee&#39; or &#39;contact&#39;&quot;</span>
404406
<span style="color: #888">)</span>
405-
406-
<span style="color: #888; font-style: italic"># We can also filter by specific operations across all verticals</span>
407-
upload_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span><span style="color: #B83838">&quot;*upload*&quot;</span><span style="color: #888">)</span>
407+
</code></pre></div>
408+
<p>Filter by specific operations across all verticals using a glob pattern.</p>
409+
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>upload_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span><span style="color: #B83838">&quot;*upload*&quot;</span><span style="color: #888">)</span>
408410
<span style="color: #2838B0">assert</span> <span style="color: #388038">len</span><span style="color: #888">(</span>upload_tools<span style="color: #888">)</span> <span style="color: #666">&gt;</span> <span style="color: #444">0</span><span style="color: #888">,</span> <span style="color: #B83838">&quot;Expected at least one upload tool&quot;</span>
409411
<span style="color: #2838B0">for</span> tool <span style="color: #A848A8">in</span> upload_tools<span style="color: #888">:</span>
410412
<span style="color: #2838B0">assert</span> <span style="color: #B83838">&quot;upload&quot;</span> <span style="color: #A848A8">in</span> tool<span style="color: #666">.</span>name<span style="color: #666">.</span>lower<span style="color: #888">(),</span> <span style="color: #444">f</span><span style="color: #B83838">&quot;Tool </span><span style="color: #B83838; text-decoration: underline">{</span>tool<span style="color: #666">.</span>name<span style="color: #B83838; text-decoration: underline">}</span><span style="color: #B83838"> doesn&#39;t contain &#39;upload&#39;&quot;</span>
411-
412-
<span style="color: #888; font-style: italic"># Get all tools except HRIS</span>
413-
non_hris_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span><span style="color: #B83838">&quot;!hris_*&quot;</span><span style="color: #888">)</span>
413+
</code></pre></div>
414+
<p>The exclude pattern is also supported.</p>
415+
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>non_hris_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span><span style="color: #B83838">&quot;!hris_*&quot;</span><span style="color: #888">)</span>
414416
<span style="color: #2838B0">assert</span> <span style="color: #388038">len</span><span style="color: #888">(</span>non_hris_tools<span style="color: #888">)</span> <span style="color: #666">&gt;</span> <span style="color: #444">0</span><span style="color: #888">,</span> <span style="color: #B83838">&quot;Expected at least one non-HRIS tool&quot;</span>
415417
<span style="color: #2838B0">for</span> tool <span style="color: #A848A8">in</span> non_hris_tools<span style="color: #888">:</span>
416418
<span style="color: #2838B0">assert</span> <span style="color: #A848A8">not</span> tool<span style="color: #666">.</span>name<span style="color: #666">.</span>startswith<span style="color: #888">(</span><span style="color: #B83838">&quot;hris_&quot;</span><span style="color: #888">),</span> <span style="color: #444">f</span><span style="color: #B83838">&quot;Tool </span><span style="color: #B83838; text-decoration: underline">{</span>tool<span style="color: #666">.</span>name<span style="color: #B83838; text-decoration: underline">}</span><span style="color: #B83838"> should not be an HRIS tool&quot;</span>
417-
418-
<span style="color: #888; font-style: italic"># Complex filtering with positive and negative patterns</span>
419-
list_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span>
419+
</code></pre></div>
420+
<p>More hectic example:</p>
421+
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>list_tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span>
420422
<span style="color: #888">[</span>
421423
<span style="color: #B83838">&quot;*list*&quot;</span><span style="color: #888">,</span> <span style="color: #888; font-style: italic"># Include list operations</span>
422424
<span style="color: #B83838">&quot;*search*&quot;</span><span style="color: #888">,</span> <span style="color: #888; font-style: italic"># Include search operations</span>

error-handling/index.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,9 @@ <h1 id="error-handling">Error Handling<a class="headerlink" href="#error-handlin
378378

379379

380380
<span style="color: #2838B0">def</span><span style="color: #A89028"> </span><span style="color: #785840">error_handling</span><span style="color: #888">()</span> <span style="color: #666">-&gt;</span> <span style="color: #444; font-style: italic">None</span><span style="color: #888">:</span>
381-
<span style="color: #888; font-style: italic"># Example 1: Configuration error - missing API key</span>
382-
original_api_key <span style="color: #666">=</span> os<span style="color: #666">.</span>environ<span style="color: #666">.</span>pop<span style="color: #888">(</span><span style="color: #B83838">&quot;STACKONE_API_KEY&quot;</span><span style="color: #888">,</span> <span style="color: #444; font-style: italic">None</span><span style="color: #888">)</span>
381+
</code></pre></div>
382+
<p>Example 1: Configuration error - missing API key</p>
383+
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>original_api_key <span style="color: #666">=</span> os<span style="color: #666">.</span>environ<span style="color: #666">.</span>pop<span style="color: #888">(</span><span style="color: #B83838">&quot;STACKONE_API_KEY&quot;</span><span style="color: #888">,</span> <span style="color: #444; font-style: italic">None</span><span style="color: #888">)</span>
383384
<span style="color: #2838B0">try</span><span style="color: #888">:</span>
384385
<span style="color: #2838B0">try</span><span style="color: #888">:</span>
385386
StackOneToolSet<span style="color: #888">(</span>api_key<span style="color: #666">=</span><span style="color: #444; font-style: italic">None</span><span style="color: #888">)</span>
@@ -392,19 +393,19 @@ <h1 id="error-handling">Error Handling<a class="headerlink" href="#error-handlin
392393
<span style="color: #2838B0">finally</span><span style="color: #888">:</span>
393394
<span style="color: #2838B0">if</span> original_api_key<span style="color: #888">:</span>
394395
os<span style="color: #666">.</span>environ<span style="color: #888">[</span><span style="color: #B83838">&quot;STACKONE_API_KEY&quot;</span><span style="color: #888">]</span> <span style="color: #666">=</span> original_api_key
395-
396-
<span style="color: #888; font-style: italic"># Example 2: Invalid vertical error</span>
397-
toolset <span style="color: #666">=</span> StackOneToolSet<span style="color: #888">()</span>
396+
</code></pre></div>
397+
<p>Example 2: Invalid vertical error</p>
398+
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>toolset <span style="color: #666">=</span> StackOneToolSet<span style="color: #888">()</span>
398399
<span style="color: #2838B0">try</span><span style="color: #888">:</span>
399400
<span style="color: #888; font-style: italic"># Use a non-existent vertical to trigger error</span>
400401
tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span><span style="color: #B83838">&quot;nonexistent_vertical_*&quot;</span><span style="color: #888">)</span>
401402
<span style="color: #888; font-style: italic"># If we get here, no tools were found but no error was raised</span>
402403
<span style="color: #2838B0">assert</span> <span style="color: #388038">len</span><span style="color: #888">(</span>tools<span style="color: #888">)</span> <span style="color: #666">==</span> <span style="color: #444">0</span><span style="color: #888">,</span> <span style="color: #B83838">&quot;Expected no tools for nonexistent vertical&quot;</span>
403404
<span style="color: #2838B0">except</span> ToolsetLoadError <span style="color: #2838B0">as</span> e<span style="color: #888">:</span>
404405
<span style="color: #2838B0">assert</span> <span style="color: #B83838">&quot;Error loading tools&quot;</span> <span style="color: #A848A8">in</span> <span style="color: #388038">str</span><span style="color: #888">(</span>e<span style="color: #888">)</span>
405-
406-
<span style="color: #888; font-style: italic"># Example 3: API error - invalid request</span>
407-
toolset <span style="color: #666">=</span> StackOneToolSet<span style="color: #888">()</span>
406+
</code></pre></div>
407+
<p>Example 3: API error - invalid request</p>
408+
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>toolset <span style="color: #666">=</span> StackOneToolSet<span style="color: #888">()</span>
408409
tools <span style="color: #666">=</span> toolset<span style="color: #666">.</span>get_tools<span style="color: #888">(</span><span style="color: #B83838">&quot;crm_*&quot;</span><span style="color: #888">)</span>
409410

410411
<span style="color: #888; font-style: italic"># Try to make an API call without required parameters</span>

file-uploads/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ <h1 id="file-uploads">File Uploads<a class="headerlink" href="#file-uploads" tit
380380
account_id <span style="color: #666">=</span> <span style="color: #B83838">&quot;45072196112816593343&quot;</span>
381381
employee_id <span style="color: #666">=</span> <span style="color: #B83838">&quot;c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA&quot;</span>
382382
</code></pre></div>
383-
<h2 id="resume-content">Resume content<a class="headerlink" href="#resume-content" title="Anchor link to this section for reference">#</a></h2>
383+
<h1 id="resume-content">Resume content<a class="headerlink" href="#resume-content" title="Anchor link to this section for reference">#</a></h1>
384384
<p>This is a sample resume content that will be uploaded to StackOne.</p>
385385
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code>resume_content <span style="color: #666">=</span> <span style="color: #B83838">&quot;&quot;&quot;</span>
386386
<span style="color: #B83838"> JOHN DOE</span>
@@ -397,7 +397,7 @@ <h2 id="resume-content">Resume content<a class="headerlink" href="#resume-conten
397397
<span style="color: #B83838"> University of Technology</span>
398398
<span style="color: #B83838"> 2016-2020 &quot;&quot;&quot;</span>
399399
</code></pre></div>
400-
<h2 id="upload-employee-document">Upload employee document<a class="headerlink" href="#upload-employee-document" title="Anchor link to this section for reference">#</a></h2>
400+
<h1 id="upload-employee-document">Upload employee document<a class="headerlink" href="#upload-employee-document" title="Anchor link to this section for reference">#</a></h1>
401401
<p>This function uploads a resume using the <code>hris_upload_employee_document</code> tool.</p>
402402
<div class="highlight" style="background: #ffffff"><pre style="line-height: 125%;"><span></span><code><span style="color: #2838B0">def</span><span style="color: #A89028"> </span><span style="color: #785840">upload_employee_document</span><span style="color: #888">()</span> <span style="color: #666">-&gt;</span> <span style="color: #444; font-style: italic">None</span><span style="color: #888">:</span>
403403
<span style="color: #2838B0">with</span> tempfile<span style="color: #666">.</span>TemporaryDirectory<span style="color: #888">()</span> <span style="color: #2838B0">as</span> temp_dir<span style="color: #888">:</span>

0 commit comments

Comments
 (0)