Skip to content

Showing static tool metatada in tools docs.#832

Open
jottakka wants to merge 8 commits intomainfrom
tool-metadata-ui-and-markdown
Open

Showing static tool metatada in tools docs.#832
jottakka wants to merge 8 commits intomainfrom
tool-metadata-ui-and-markdown

Conversation

@jottakka
Copy link
Contributor

@jottakka jottakka commented Feb 27, 2026

Note

Medium Risk
Adds new metadata-driven UI (per-tool “Execution hints” and toolkit-level service-domain badge) plus new filtering logic and a reporting CLI; primary risk is incorrect/partial metadata rendering or filtering when metadata is missing/null.

Overview
Surfaces Engine-provided tool metadata in toolkit docs by adding a new ToolMetadataSection (“Execution hints”) that displays operations, service domains, behavior flags (readOnly/destructive/idempotent/openWorld), and optional extra JSON, and wiring tool.metadata through ToolkitPage and ToolSection.

Adds a toolkit-level “Service domain” badge when all tools share exactly one domain (getSharedServiceDomain), introduces style maps for operation/domain badges in constants.ts, and extends filterTools to support metadata-based filtering (operations + behavior flags) with new Vitest coverage.

Includes a new pnpm metadata-report CLI (toolkit-docs-generator/scripts/report-tool-metadata.ts) to audit metadata coverage/distinct enum values, and minor UI polish for the expandable DynamicCodeBlock header/controls.

Written by Cursor Bugbot for commit b03bd5e. This will update automatically on new commits. Configure here.

- P1: create metadata-report script and tool-metadata-audit utility; add
  pnpm dlx tsx invocation to package.json so pnpm metadata-report works
- P2: resolve data dir relative to script file (cwd-independent); exit 1
  on error instead of silently swallowing it
- P2: gate page-size and sort dropdowns behind enableFilters; export
  filterTools with operations/behavior-flag filtering via options object;
  extract helpers to stay within complexity and param-count lint rules;
  add 13 tests covering the new filter paths
- P2: export getSharedServiceDomain from toolkit-page (was internal); add
  5 tests covering shared/mixed/empty/multi-domain edge cases
- P3: fix telemetry page title typo (Telemtry -> Telemetry)

Made-with: Cursor
@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Feb 27, 2026 1:18am

Request Review

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Style Review

Found 1 style suggestion(s).

Powered by Vale + Claude

)}
</SelectContent>
</Select>
</>
Copy link

Choose a reason for hiding this comment

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

Page size and sort hidden when filters disabled

Medium Severity

The page size and sort dropdowns were moved inside the enableFilters block. When enableFilters is false, users no longer see these controls, even if the toolbar is visible (e.g. when enableSearch is true). Previously, page size and sort were always shown whenever the toolbar was shown.

Fix in Cursor Fix in Web

The prior commit added TOOL_METADATA_SERVICE_DOMAIN_STYLES,
TOOL_METADATA_OPERATION_STYLES, and TOOL_METADATA_FALLBACK_STYLE imports
to toolkit-page.tsx but the corresponding exports were never committed to
constants.ts, breaking the Vercel build.

Made-with: Cursor
- Add BehaviorFlagKey type export to types/index.ts (fixes Vercel build
  error: 'BehaviorFlagKey' not exported from types)
- getSharedServiceDomain: add typeof string guard before accepting a
  serviceDomains entry; prevents TypeError if JSON has a non-string value
  calling .replace() on a Badge label (high severity)
- matchesBehaviorFlags: skip entries where expected is undefined; with
  Partial<Record<BehaviorFlagKey, boolean>> a key can be undefined to
  mean "don't filter", but the old code compared !== expected which
  incorrectly excluded tools (low severity)

Made-with: Cursor
</div>
)}
{enableFilters && (
<Select
Copy link

Choose a reason for hiding this comment

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

FilterToolsOptions never passed to filterTools

Low Severity

filterTools was extended with FilterToolsOptions (activeOperations, behaviorFlags), but AvailableToolsTable never passes these options. The new filtering logic is dead code in production.

Additional Locations (1)

Fix in Cursor Fix in Web


const behaviorRows = buildBehaviorRows(metadata.behavior);
const hasOperations = metadata.behavior.operations.length > 0;
const hasServiceDomains = metadata.classification.serviceDomains.length > 0;
Copy link

Choose a reason for hiding this comment

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

ToolMetadataSection crashes on partial metadata

Low Severity

ToolMetadataSection accesses metadata.behavior and metadata.classification without optional chaining. If metadata exists but is partial (e.g. missing behavior or classification, or behavior.operations / classification.serviceDomains undefined), the component will throw at runtime.

Fix in Cursor Fix in Web

Copy link

@cursor cursor bot left a comment

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 2 potential issues.

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

} from "../constants";
import type { ToolMetadata, ToolMetadataBehavior } from "../types";

type BehaviorFlagKey = "readOnly" | "destructive" | "idempotent" | "openWorld";
Copy link

Choose a reason for hiding this comment

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

Redundant BehaviorFlagKey type definition

Low Severity

BehaviorFlagKey is defined locally in tool-metadata-section.tsx but the same type is exported from types/index.ts. available-tools-table imports it from types. Duplicating the type risks drift if one definition is updated without the other.

Additional Locations (1)

Fix in Cursor Fix in Web

key={operation}
styles={TOOL_METADATA_OPERATION_STYLES}
value={operation}
/>
Copy link

Choose a reason for hiding this comment

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

EnumBadge crashes on non-string enum values

Low Severity

EnumBadge receives operation and domain from metadata.behavior.operations and metadata.classification.serviceDomains and passes them to formatEnumLabel(value), which calls value.split("_"). If the JSON or API returns non-string values (e.g. numbers or null), a TypeError is thrown because non-strings have no split method.

Additional Locations (1)

Fix in Cursor Fix in Web

@jottakka jottakka requested a review from teallarson February 27, 2026 01:27
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