Skip to content

feat(server-utils): Send gen_ai.tool.definitions in the documented format - #26445

Open
sentry-junior[bot] wants to merge 5 commits into
developfrom
feat/gen-ai-tool-definitions-format
Open

sentry-junior[bot] wants to merge 5 commits into
developfrom
feat/gen-ai-tool-definitions-format

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

What

Every gen AI integration now sends gen_ai.tool.definitions as a flat list of { type: "function", name, description, parameters } objects, which is the documented format. Before, each integration sent its provider's raw format: OpenAI Chat Completions and Mistral nested the tool under function, Anthropic used input_schema, Bedrock used inputSchema.json, Google used parametersJsonSchema, and Mastra sent a list of names.

Why

The product has to read one shape, not one per provider. Tools that the provider runs itself (OpenAI web_search*, Anthropic server tools, Vercel provider tools) have no schema, so they keep their own type and are sent unchanged.

Some smaller behavior changes:

  • LangChain definitions now include parameters. Before, they only had the name and description.
  • Zod schemas (from LangGraph lc_kwargs.schema) are left out instead of being sent as Zod internals.
  • Google tools entries without functionDeclarations (such as googleSearch) no longer add null entries.
  • Provider-specific extras like strict and cache_control are dropped.

Open question for review: should this count as a breaking change for anyone who parses the attribute? The attribute name stays the same, but its value changes shape.

The Cloudflare google-genai suite only had its expected string updated. I didn't run it locally.

via webb.

--

View Session [Sentry]

…rmat

Co-Authored-By: Alexander Webb <alexander.webb@sentry.io>
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Compared: 1d6f1ff (PR test merge using develop at 8c549b9)

Against: 8c549b9 (develop) · base run #67421

✅ Baseline matches: this diff contains only this PR's changes.

Path Size % Change Change
@sentry/browser 30.23 kB - -
@sentry/browser - with treeshaking flags 28.43 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 28.33 kB - -
@sentry/browser (incl. Tracing) 52.81 kB - -
@sentry/browser (incl. Tracing Core) 40.33 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 52.81 kB - -
@sentry/browser (incl. Tracing, Profiling) 55.69 kB - -
@sentry/browser (incl. Tracing, Replay) 92.88 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 81.7 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 97.22 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 110.8 kB - -
@sentry/browser (incl. Feedback) 48.17 kB - -
@sentry/browser (incl. sendFeedback) 30.81 kB - -
@sentry/browser (incl. FeedbackAsync) 35.84 kB - -
@sentry/browser (incl. Metrics) 31.55 kB - -
@sentry/browser (incl. Logs) 31.83 kB - -
@sentry/browser (incl. Metrics & Logs) 32.49 kB - -
@sentry/react 32.24 kB - -
@sentry/react (incl. Tracing) 55.45 kB - -
@sentry/vue 38.45 kB - -
@sentry/vue (incl. Tracing) 55.75 kB - -
@sentry/svelte 30.24 kB - -
@sentry/remix (Remix 3 client bundle) 58.46 kB - -
CDN Bundle 32.16 kB - -
CDN Bundle (incl. Tracing) 53.19 kB - -
CDN Bundle (incl. Logs, Metrics) 34.95 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 55.76 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 76.02 kB - -
CDN Bundle (incl. Tracing, Replay) 91.1 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 93.71 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 96.51 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 99.07 kB - -
CDN Bundle - uncompressed 93.91 kB - -
CDN Bundle (incl. Tracing) - uncompressed 157.26 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 102.24 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 164.88 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 232.48 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 277.53 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 285.16 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.46 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 297.08 kB - -
@sentry/nextjs (client) 59.15 kB - -
@sentry/sveltekit (client) 54.06 kB - -
@sentry/core/server 45.28 kB - -
@sentry/core/browser 14.41 kB - -
@sentry/node 155.36 kB +0.08% +124 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.46 kB - -
@sentry/node - without tracing 88.92 kB +0.01% +1 B 🔺
@sentry/node - without channel injection 144.28 kB +0.09% +126 B 🔺
@sentry/aws-serverless 99.81 kB +0.26% +254 B 🔺
@sentry/cloudflare (withSentry) - minified 208.88 kB - -
@sentry/cloudflare (withSentry) 484.65 kB - -
@sentry/cloudflare (withSentry, instrumented CommonJS package) - minified 1.02 MB - -
@sentry/nextjs/cloudflare (withSentry) - minified 234.11 kB - -

View base workflow run

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Optional E2E tests

Some optional checks were not successful. They do not block the merge. 6 not successful, 55 successful. See the run.

Check Status
❌ CI: Optional E2E Tests / E2E cloudflare-workers-send-to-sentry Test (optional) Failing after 2m Details
❌ CI: Optional E2E Tests / E2E node-openai-decisions (latest) Test (optional) Failing after 27s Details
❌ CI: Optional E2E Tests / E2E cloudflare-pi-durable (latest) Test (optional) Failing after 38s Details
❌ CI: Optional E2E Tests / E2E nextjs-16-tunnel (cloudflare) Test (optional) Failing after 1m Details
❌ CI: Optional E2E Tests / E2E node-pi-durable (latest) Test (optional) Failing after 25s Details
❌ CI: Optional E2E Tests / E2E node-openai-decisions Test (optional) Failing after 28s Details
Successful checks
Check Status
✅ CI: Optional E2E Tests / E2E cloudflare-mastra Test (optional) Successful in 54s Details
✅ CI: Optional E2E Tests / E2E cloudflare-think Test (optional) Successful in 55s Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries Test (optional) Successful in 48s Details
✅ CI: Optional E2E Tests / E2E node-eve (orchestrion) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E debug-id-sourcemaps Test (optional) Successful in 41s Details
✅ CI: Optional E2E Tests / E2E cloudflare-agent Test (optional) Successful in 46s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (cloudflare) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E cloudflare-workers-without-tracing-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v1 Test (optional) Successful in 33s Details
✅ CI: Optional E2E Tests / E2E node-fastify-6 Test (optional) Successful in 40s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-flue-send-to-sentry Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E deno (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E express-5 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (turbo) Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-flue Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E solidstart-2 Test (optional) Successful in 56s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-14-supabase Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E cloudflare-pi-durable Test (optional) Successful in 49s Details
✅ CI: Optional E2E Tests / E2E astro-7 (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (development) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E express-5 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-flue (latest) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E express-5 (cloudflare) Test (optional) Successful in 58s Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (cloudflare, latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (bun) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (static / nuxt generate) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E node-eve (content off) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E astro-7 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-mastra Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E cloudflare-think (ai v6) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (cloudflare) Test (optional) Successful in 45s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 (kv-cache) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry (static trace lifecycle) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E node-pi-durable Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E nestjs-12 (deno) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E gen-ai-libraries (latest) Test (optional) Successful in 47s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-cloudflare Test (optional) Successful in 43s Details
✅ CI: Optional E2E Tests / E2E nuxt-5 Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E react-router-7-framework-instrumentation Test (optional) Successful in 2m Details
✅ CI: Optional E2E Tests / E2E node-express-mcp-v2 Test (optional) Successful in 28s Details
✅ CI: Optional E2E Tests / E2E solidstart-2-tunnel Test (optional) Successful in 44s Details
✅ CI: Optional E2E Tests / E2E node-mastra (latest) Test (optional) Successful in 59s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel (cloudflare) Test (optional) Successful in 36s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-cloudflare Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E nuxt-5-tunnel Test (optional) Successful in 37s Details
✅ CI: Optional E2E Tests / E2E node-eve (0.x) Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E node-eve Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nuxt-5-sourcemaps (client source maps kept) Test (optional) Successful in 42s Details
✅ CI: Optional E2E Tests / E2E tanstackstart-react-sourcemaps Test (optional) Successful in 35s Details
✅ CI: Optional E2E Tests / E2E node-express-send-to-sentry Test (optional) Successful in 1m Details
✅ CI: Optional E2E Tests / E2E nextjs-15 (latest) Test (optional) Successful in 3m Details
✅ CI: Optional E2E Tests / E2E nextjs-16 (vinext, bun) Test (optional) Successful in 2m Details

@mydea
mydea marked this pull request as ready for review November 17, 2026 09:14
…efinitions-format

# Conflicts:
#	packages/server-utils/src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts
…efinitions-format

# Conflicts:
#	packages/server-utils/src/ai/pi-ai/chat.ts
…efinitions-format

# Conflicts:
#	packages/server-utils/src/ai/langchain/utils.ts
#	packages/server-utils/src/ai/langgraph/agent-span.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3b37818. Configure here.

* Tools that a provider runs itself (such as OpenAI's `web_search`) have no schema and are kept as they are.
*/
export function getToolDefinitionsAttribute(tools: unknown): string | undefined {
const definitions = Array.isArray(tools) ? tools.map(toGenAiToolDefinition).filter(tool => tool !== undefined) : [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Chained map and filter loops

Low Severity

The SDK performance convention asks to avoid chaining .map and .filter over the same array; a classic for loop is the expected replacement. getToolDefinitionsAttribute walks tools twice this way. I flagged this because it is called out in the PR review rules.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 3b37818. Configure here.

…efinitions-format

# Conflicts:
#	packages/server-utils/src/ai/openai/index.ts

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants