Skip to content

Commit cfb14e1

Browse files
committed
feat(tests): enhance MCP tool validation with combined name length check
- Added a new constant for the Cursor IDE prefix and a test to ensure the combined length of the tool name and prefix does not exceed 60 characters. - Updated the tool registration name for clarity and consistency.
1 parent 42c11a7 commit cfb14e1

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

mcp-server/src/server.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ const TOOL_NAME_MAX_LENGTH = 64;
3030
const TOOL_NAME_PATTERN = /^[a-zA-Z0-9_\-./]+$/;
3131
// No hard spec limit; 1024 is the practical ceiling across major LLM providers
3232
const TOOL_DESCRIPTION_MAX_LENGTH = 1024;
33+
// Cursor IDE prefixes tool names with "extension-<server>:" when displaying them.
34+
// Combined length must stay ≤ 60 to avoid filtering warnings.
35+
const CURSOR_SERVER_PREFIX = "extension-currents:";
36+
const CURSOR_COMBINED_MAX_LENGTH = 60;
3337

3438
describe("MCP tool best practices", () => {
3539
it("has at least one registered tool", () => {
@@ -59,6 +63,14 @@ describe("MCP tool best practices", () => {
5963
expect(name.length).toBeGreaterThan(0);
6064
});
6165

66+
it(`combined Cursor name length ≤ ${CURSOR_COMBINED_MAX_LENGTH}`, () => {
67+
const combined = `${CURSOR_SERVER_PREFIX}${name}`;
68+
expect(
69+
combined.length,
70+
`"${combined}" is ${combined.length} chars`
71+
).toBeLessThanOrEqual(CURSOR_COMBINED_MAX_LENGTH);
72+
});
73+
6274
// ── description constraints ─────────────────────────────────
6375
it("description is not empty", () => {
6476
expect(description.length).toBeGreaterThan(0);

mcp-server/src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ server.registerTool(
141141
);
142142

143143
server.registerTool(
144-
"currents-get-affected-test-executions-by-action",
144+
"currents-get-affected-executions",
145145
{
146146
description:
147147
"List test executions where a specific action/rule was applied, within a date range. Uses cursor-based pagination. Requires actionId, date_start, and date_end.",

0 commit comments

Comments
 (0)