MCPcopy Index your code
hub / github.com/coder/coder / ComputerUseProviderTool

Function ComputerUseProviderTool

coderd/x/chatd/chattool/computeruse.go:130–153  ·  view source on GitHub ↗

ComputerUseProviderTool creates the provider-defined computer-use tool definition using the declared model-facing desktop geometry.

(provider string, declaredWidth, declaredHeight int)

Source from the content-addressed store, hash-verified

128// ComputerUseProviderTool creates the provider-defined computer-use tool
129// definition using the declared model-facing desktop geometry.
130func ComputerUseProviderTool(provider string, declaredWidth, declaredHeight int) (fantasy.Tool, error) {
131 switch DefaultComputerUseProvider(provider) {
132 case ComputerUseProviderAnthropic:
133 // The run callback is nil because execution is handled separately
134 // by the AgentTool runner in the chatloop. We extract just the
135 // provider-defined tool definition.
136 return fantasyanthropic.NewComputerUseTool(
137 fantasyanthropic.ComputerUseToolOptions{
138 DisplayWidthPx: int64(declaredWidth),
139 DisplayHeightPx: int64(declaredHeight),
140 ToolVersion: fantasyanthropic.ComputerUse20251124,
141 },
142 nil,
143 ).Definition(), nil
144 case ComputerUseProviderOpenAI:
145 // OpenAI's GA computer tool schema does not accept display
146 // dimensions. The declared geometry is applied through screenshot
147 // sizing and desktop action coordinate scaling.
148 return openaicomputeruse.Tool(), nil
149 default:
150 return nil, xerrors.Errorf("unsupported computer use provider %q, supported providers: %s", provider,
151 strings.Join(SupportedComputerUseProviders(), ", "))
152 }
153}
154
155func (t *computerUseTool) ProviderOptions() fantasy.ProviderOptions {
156 return t.providerOptions

Callers 2

Calls 3

ErrorfMethod · 0.45

Tested by 1