feat: Shorten task ID to <tool-name>-<12-char-suffix>#725
Draft
jirispilka wants to merge 1 commit intomasterfrom
Draft
feat: Shorten task ID to <tool-name>-<12-char-suffix>#725jirispilka wants to merge 1 commit intomasterfrom
jirispilka wants to merge 1 commit intomasterfrom
Conversation
Replace the long call-tool-<name>-<UUID> task ID (~70 chars) with a short <tool.name>-<12 base64url chars> form. Uses randomBytes(9) from node:crypto — no new dependency. MCP spec compliant: taskId stays a unique string, and the 72-bit random suffix combined with session-scoped taskStore binding meets the entropy guidance (see res/mcp_task_reference.md). Also adds a format assertion in the existing task integration test and updates the stale "32 hex chars" comment in the task reference. https://claude.ai/code/session_012N7gXd5tWLp9Xic5JDVif9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #705.
Summary
call-tool-apify--rag-web-browser-550e8400-e29b-41d4-a716-446655440000(~70 chars).${tool.name}-${randomBytes(9).toString('base64url')}→apify--rag-web-browser-x7kQ9mZpA1bC(~35 chars).randomBytes; no new dependency (avoids pullingnanoidfor one call).tool.name(canonical, slash-safe) rather than raw requestname(which can be the legacyapify-slash-…form).MCP spec compliance
taskIdMUST be a string — ✓taskStore)mcpSessionId(seesrc/mcp/server.ts:543).Spec ref: https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/tasks
Changes
src/mcp/server.ts— swaprandomUUIDimport forrandomBytes; replace the task-ID expression.res/mcp_task_reference.md— update stale// 32 hex charscomment.tests/integration/suite.ts— add format assertion to the existing task-flow test.Test plan
npm run type-check— passesnpm run lint— passesnpm run test:unit(515/515) — passesnpm run test:integration— requiresAPIFY_TOKEN; task-flow suite includes a new format assertiontools-call <actor> task:='{"ttl":60000}' <args>→ inspecttaskCreated.taskIdshapetools-call <actor> <args>returns unchangedCallToolResult(regression check)https://claude.ai/code/session_012N7gXd5tWLp9Xic5JDVif9