Skip to content

refactoring: executeTool uses tool as parameter#14516

Merged
lgrammel merged 4 commits intomainfrom
lg/IXV9ap1h
Apr 16, 2026
Merged

refactoring: executeTool uses tool as parameter#14516
lgrammel merged 4 commits intomainfrom
lg/IXV9ap1h

Conversation

@lgrammel
Copy link
Copy Markdown
Collaborator

@lgrammel lgrammel commented Apr 16, 2026

Background

executeTool in provider utils was working on the execute function level. This lead to having to push bind into executeToolCall and weakened type checking since any input, context etc could be sent.

Summary

  • executeTool works on a tool level with tighter type validation
  • add ExecutableTool type and isExecutableTool helper for type narrowing

Related Work

Discovered during #14515

@tigent tigent Bot added ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label maintenance CI, internal documentation, automations, etc labels Apr 16, 2026
execute: tool.execute!.bind(tool),
input,
tool,
input: input as InferToolInput<typeof tool>,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result of tightening the types on executeTool

messages,
abortSignal: toolAbortSignal,
context,
context: context as InferToolContext<typeof tool>,
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result of tightening the types on executeTool

@lgrammel lgrammel changed the title Lg/ixv9ap1h refactoring: executeTool uses tool as parameter Apr 16, 2026
@lgrammel lgrammel marked this pull request as ready for review April 16, 2026 09:56
@lgrammel lgrammel merged commit add1126 into main Apr 16, 2026
18 checks passed
@lgrammel lgrammel deleted the lg/IXV9ap1h branch April 16, 2026 10:06
@vercel-ai-sdk
Copy link
Copy Markdown
Contributor

vercel-ai-sdk Bot commented Apr 16, 2026

🚀 Published in:

Package Version
ai 7.0.0-beta.100
@ai-sdk/alibaba 2.0.0-beta.28
@ai-sdk/amazon-bedrock 5.0.0-beta.33
@ai-sdk/angular 3.0.0-beta.100
@ai-sdk/anthropic 4.0.0-beta.29
@ai-sdk/assemblyai 3.0.0-beta.23
@ai-sdk/azure 4.0.0-beta.33
@ai-sdk/baseten 2.0.0-beta.26
@ai-sdk/black-forest-labs 2.0.0-beta.22
@ai-sdk/bytedance 2.0.0-beta.23
@ai-sdk/cerebras 3.0.0-beta.26
@ai-sdk/cohere 4.0.0-beta.23
@ai-sdk/deepgram 3.0.0-beta.22
@ai-sdk/deepinfra 3.0.0-beta.26
@ai-sdk/deepseek 3.0.0-beta.24
@ai-sdk/elevenlabs 3.0.0-beta.22
@ai-sdk/fal 3.0.0-beta.22
@ai-sdk/fireworks 3.0.0-beta.26
@ai-sdk/gateway 4.0.0-beta.55
@ai-sdk/gladia 3.0.0-beta.22
@ai-sdk/google 4.0.0-beta.39
@ai-sdk/google-vertex 5.0.0-beta.49
@ai-sdk/groq 4.0.0-beta.25
@ai-sdk/huggingface 2.0.0-beta.26
@ai-sdk/hume 3.0.0-beta.22
@ai-sdk/klingai 4.0.0-beta.23
@ai-sdk/langchain 3.0.0-beta.100
@ai-sdk/llamaindex 3.0.0-beta.100
@ai-sdk/lmnt 3.0.0-beta.22
@ai-sdk/luma 3.0.0-beta.22
@ai-sdk/mcp 2.0.0-beta.28
@ai-sdk/mistral 4.0.0-beta.24
@ai-sdk/moonshotai 3.0.0-beta.26
@ai-sdk/open-responses 2.0.0-beta.24
@ai-sdk/openai 4.0.0-beta.33
@ai-sdk/openai-compatible 3.0.0-beta.26
@ai-sdk/otel 1.0.0-beta.46
@ai-sdk/perplexity 4.0.0-beta.25
@ai-sdk/prodia 2.0.0-beta.25
@ai-sdk/provider-utils 5.0.0-beta.21
@ai-sdk/react 4.0.0-beta.100
@ai-sdk/replicate 3.0.0-beta.23
@ai-sdk/revai 3.0.0-beta.23
@ai-sdk/rsc 3.0.0-beta.101
@ai-sdk/svelte 5.0.0-beta.100
@ai-sdk/togetherai 3.0.0-beta.26
@ai-sdk/valibot 3.0.0-beta.21
@ai-sdk/vercel 3.0.0-beta.26
@ai-sdk/vue 4.0.0-beta.100
@ai-sdk/workflow 1.0.0-beta.14
@ai-sdk/xai 4.0.0-beta.38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label maintenance CI, internal documentation, automations, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants