Skip to content

feat: tool annotations (title + readOnly/destructive hints) - #44

Merged
johnxie merged 1 commit into
mainfrom
feat/tool-annotations
Jun 5, 2026
Merged

feat: tool annotations (title + readOnly/destructive hints)#44
johnxie merged 1 commit into
mainfrom
feat/tool-annotations

Conversation

@johnxie

@johnxie johnxie commented Jun 5, 2026

Copy link
Copy Markdown
Member

What & why

Generated tools carried no MCP annotations. The codegen already had latent opts.actions plumbing — this wires it and adds method-derived hints, so every tool gets a title + readOnlyHint/destructiveHint. Improves client UX/safety display and is a hard prerequisite for the Claude Connectors Directory.

Changes

  • packages/openapi-codegen/src/codegen.ts: derive readOnlyHint (GET/HEAD) + destructiveHint (DELETE) from tool.method; take title from opts.actions. (Also drops the prior invalid description annotation field — description stays the 2nd positional arg.)
  • packages/server/scripts/gen-taskade-mcp-tools.ts: pass titles built from HUMANIZED_TASKADE_ACTIONS.
  • packages/server/src/tools.generated.ts: regenerated.

Zero-regression (verified)

  • Generated diff is purely additive: 173 insertions, 0 deletions — only an annotation object added per server.tool(...); names, descriptions, Zod schemas, and handlers unchanged. Still 57 server.tool( calls.
  • Runtime check (instantiate McpServer + setupTools): 57 registered, 57 titled, 25 read-only, 9 destructive; taskDelete → destructive, workspacesGet → read-only. SDK accepts the (name, description, schema, annotations, cb) overload.
  • yarn build + yarn lint clean. Changeset added (patch).

Wire the codegen's annotation support: derive readOnlyHint/destructiveHint from
each operation's HTTP method (GET/HEAD read-only, DELETE destructive) and pass a
human title from HUMANIZED_TASKADE_ACTIONS. Covers all 57 tools via one generator
change; tools.generated.ts regenerated.

Runtime-verified: 57 tools register, 57 titled, 25 read-only, 9 destructive;
the generated diff is purely additive (no schema/handler changes).
@johnxie
johnxie requested a review from Copilot June 5, 2026 11:20
@changeset-bot

changeset-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 05bbc4c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@taskade/mcp-server Patch
@taskade/mcp-openapi-codegen Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI 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.

Pull request overview

This PR enhances the OpenAPI → MCP tool generation pipeline to attach MCP tool annotations to each generated tool registration, enabling clients to display a human-friendly title and safety hints (readOnlyHint / destructiveHint) derived from HTTP methods.

Changes:

  • Update the OpenAPI codegen to always emit an annotations object and to derive readOnlyHint (GET/HEAD) and destructiveHint (DELETE), with optional title sourced from opts.actions.
  • Update the Taskade tools generation script to pass per-tool titles from HUMANIZED_TASKADE_ACTIONS.
  • Regenerate tools.generated.ts to include annotations for each server.tool(...) call and add a changeset entry.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/openapi-codegen/src/codegen.ts Always emits MCP tool annotations; derives read-only/destructive hints from HTTP method; wires opts.actions.title into tool annotations.
packages/server/scripts/gen-taskade-mcp-tools.ts Passes a title map into codegen based on HUMANIZED_TASKADE_ACTIONS.
packages/server/src/tools.generated.ts Regenerated output adding annotations objects to each tool registration.
.changeset/tool-annotations.md Declares patch releases describing the new annotation behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +89 to +92
const description = opts.actions?.[tool.name]?.description ?? tool.description;

if (Object.keys(annotations).length > 0) {
toolArgs.push(JSON.stringify(annotations));
}
const toolArgs = [`"${tool.name}"`, `"${description}"`, generateToolInputFromParsedTool(tool)];

Comment on lines +8 to +12
// Supply a human-friendly title per tool from the humanized action map; the
// codegen derives readOnly/destructive hints from each operation's HTTP method.
const actions = Object.fromEntries(
Object.entries(HUMANIZED_TASKADE_ACTIONS).map(([name, title]) => [name, { title }]),
);
@johnxie

johnxie commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

✅ Validation & QA — ready to merge

Two Copilot comments — both validated as valid-but-non-impactful (no change; rationale below):

Copilot finding Verdict Why no change
"${description}" interpolation could break on quotes/newlines pre-existing tool.description was already interpolated identically before this PR; titles I add go through JSON.stringify (escaped). Build/lint/57-tool registration all pass, so no current description breaks it.
actions from HUMANIZED_TASKADE_ACTIONS may drift from ENABLED low impact drift just yields a missing title (graceful); verified all 57 enabled tools are titled today.

QA: regenerated diff is purely additive (173 insertions, 0 deletions); runtime check → 57 registered, 57 titled, 25 readOnly, 9 destructive; taskDelete→destructive, workspacesGet→readOnly; build+lint+test green.

Confidence: high · zero regression. Merging. (Hardening of the two notes tracked as optional follow-up.)

@johnxie
johnxie merged commit ff6a9da into main Jun 5, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request Jun 5, 2026
@johnxie
johnxie deleted the feat/tool-annotations branch June 5, 2026 12:03
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