Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

local-shell-tool.ts

35 lines863 Bytes

1import { openAIProviderTool } from './openai-provider-tool'
2import type { Tool as SDKTool } from 'openai/resources/responses/responses'
3import type { Tool } from '@tanstack/ai'
4​
5type LocalShellToolConfig = SDKTool.LocalShell
6​
7export type { LocalShellToolConfig }
8​
9/**
10 * Converts a standard Tool to OpenAI LocalShellTool format
11 */
12export function convertLocalShellToolToAdapterFormat(
13 _tool: Tool,
14): LocalShellToolConfig {
15 return {
16 type: 'local_shell',
17 }
19​
20/**
21 * Creates a standard Tool from LocalShellTool parameters.
22 *
23 * Base (non-branded) factory. Providers that need branded return types should
24 * re-wrap this in their own package.
25 */
26export function localShellTool(): Tool {
27 return openAIProviderTool(
28 {
29 name: 'local_shell',
30 description: 'Execute local shell commands',
31 metadata: {},
32 },
33 'local_shell',
34 )