Skip to content

Showing static tool metatada in tools docs.#832

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

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

Conversation

@jottakka
Copy link
Contributor

@jottakka jottakka commented Feb 27, 2026

Note

Medium Risk
Updates the toolkit docs UI and filtering logic to incorporate per-tool metadata (operations/behavior/service domains), which could change table results and rendering when metadata is missing or malformed.

Overview
Surfaces static tool metadata in toolkit docs: each tool page now renders an "Execution hints" section showing operation/service-domain badges, MCP behavior flags, and expandable extras JSON when present.

Enhances the Available tools table to support OAuth scope filters, sorting by scopes, and new metadata filters for operations plus tri-state behavior flags (Any/Yes/No); filterTools is refactored to accept these options and is covered by new Vitest cases.

Adds styling maps for metadata enums, shows a toolkit-level service-domain badge when all tools share a single domain, and introduces a metadata-report CLI (with audit utility) to summarize metadata coverage and distinct enum values.

Written by Cursor Bugbot for commit 1894908. 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 28, 2026 1:44am

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

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

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

} 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
Reintroduce metadata filter controls for operations and behavior flags and wire them into tool filtering so metadata-based filtering appears and works in the available tools table.

Made-with: Cursor
return word.toLowerCase();
})
.join(" ");
}
Copy link

Choose a reason for hiding this comment

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

Duplicated formatting function across two files

Low Severity

formatMetadataLabel in available-tools-table.tsx and formatEnumLabel in tool-metadata-section.tsx are identical implementations with different names. Both split on underscores, capitalize the first word, lowercase the rest, and special-case "crm". One shared utility would avoid divergence if the logic ever needs updating.

Additional Locations (1)

Fix in Cursor Fix in Web

destructive: "Destructive",
idempotent: "Idempotent",
openWorld: "Open world",
};
Copy link

Choose a reason for hiding this comment

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

Duplicated behavior label constants across two files

Low Severity

BEHAVIOR_FILTER_LABELS in available-tools-table.tsx and BEHAVIOR_LABELS in tool-metadata-section.tsx contain identical key-value mappings (e.g. readOnly → "Read only"). These are the same data under different names, creating a risk that a label change in one file isn't reflected in the other.

Additional Locations (1)

Fix in Cursor Fix in Web

export {
buildBehaviorRows,
ToolMetadataSection,
} from "./tool-metadata-section";
Copy link

Choose a reason for hiding this comment

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

Exported function unused outside its own module

Low Severity

buildBehaviorRows is exported from components/index.ts (and re-exported from the top-level barrel) but is never imported or used anywhere outside tool-metadata-section.tsx. This is dead exported surface area that adds unnecessary API breadth.

Fix in Cursor Fix in Web

Group operations and behavior into a cleaner metadata filter row, keep boolean behavior filters as clickable chips with distinct Any/Yes/No styling, and stabilize the controls count area so toolbar layout doesn't shift as result totals change.

Made-with: Cursor
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.

return word.toLowerCase();
})
.join(" ");
}
Copy link

Choose a reason for hiding this comment

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

Identical formatting function duplicated across two new files

Low Severity

formatEnumLabel in tool-metadata-section.tsx and formatMetadataLabel in available-tools-table.tsx are identical implementations — same split-on-underscore logic, same special case for "crm", same title-casing. If either is updated (e.g., adding more acronym handling), the other risks becoming inconsistent. These belong in a shared utility.

Additional Locations (1)

Fix in Cursor Fix in Web

destructive: "Destructive",
idempotent: "Idempotent",
openWorld: "Open world",
};
Copy link

Choose a reason for hiding this comment

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

Behavior labels map and type duplicated across files

Low Severity

tool-metadata-section.tsx locally redefines the BehaviorFlagKey type (already exported from types/index.ts) and declares BEHAVIOR_LABELS — an identical copy of BEHAVIOR_FILTER_LABELS in available-tools-table.tsx. Both map the same four keys to the same four human-readable strings. These could be shared from a single source.

Additional Locations (1)

Fix in Cursor Fix in Web

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