Skip to content

Commit 1f48e0d

Browse files
committed
Update MCP e2e tests to match new semantic conventions
1 parent b62ba22 commit 1f48e0d

File tree

1 file changed

+13
-6
lines changed
  • dev-packages/e2e-tests/test-applications/node-express/tests

1 file changed

+13
-6
lines changed

dev-packages/e2e-tests/test-applications/node-express/tests/mcp.test.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test('Should record transactions for mcp handlers', async ({ baseURL }) => {
1818
return transactionEvent.transaction === 'POST /messages';
1919
});
2020
const toolTransactionPromise = waitForTransaction('node-express', transactionEvent => {
21-
return transactionEvent.transaction === 'mcp-server/tool:echo';
21+
return transactionEvent.transaction === 'tools/call echo';
2222
});
2323

2424
const toolResult = await client.callTool({
@@ -39,19 +39,22 @@ test('Should record transactions for mcp handlers', async ({ baseURL }) => {
3939

4040
const postTransaction = await postTransactionPromise;
4141
expect(postTransaction).toBeDefined();
42+
expect(postTransaction.contexts?.trace?.op).toEqual('http.server');
4243

4344
const toolTransaction = await toolTransactionPromise;
4445
expect(toolTransaction).toBeDefined();
46+
expect(toolTransaction.contexts?.trace?.op).toEqual('mcp.server');
47+
expect(toolTransaction.contexts?.trace?.data?.['mcp.method.name']).toEqual('tools/call');
48+
// TODO: When https://github.com/modelcontextprotocol/typescript-sdk/pull/358 is released check for trace id equality between the post transaction and the handler transaction
4549

46-
// TODO: When https://github.com/modelcontextprotocol/typescript-sdk/pull/358 is released check for trace id equality between the post transaction and the handler transaction
4750
});
4851

4952
await test.step('resource handler', async () => {
5053
const postTransactionPromise = waitForTransaction('node-express', transactionEvent => {
5154
return transactionEvent.transaction === 'POST /messages';
5255
});
5356
const resourceTransactionPromise = waitForTransaction('node-express', transactionEvent => {
54-
return transactionEvent.transaction === 'mcp-server/resource:echo';
57+
return transactionEvent.transaction === 'resources/read echo://foobar';
5558
});
5659

5760
const resourceResult = await client.readResource({
@@ -64,10 +67,12 @@ test('Should record transactions for mcp handlers', async ({ baseURL }) => {
6467

6568
const postTransaction = await postTransactionPromise;
6669
expect(postTransaction).toBeDefined();
70+
expect(postTransaction.contexts?.trace?.op).toEqual('http.server');
6771

6872
const resourceTransaction = await resourceTransactionPromise;
6973
expect(resourceTransaction).toBeDefined();
70-
74+
expect(resourceTransaction.contexts?.trace?.op).toEqual('mcp.server');
75+
expect(resourceTransaction.contexts?.trace?.data?.['mcp.method.name']).toEqual('resources/read');
7176
// TODO: When https://github.com/modelcontextprotocol/typescript-sdk/pull/358 is released check for trace id equality between the post transaction and the handler transaction
7277
});
7378

@@ -76,7 +81,7 @@ test('Should record transactions for mcp handlers', async ({ baseURL }) => {
7681
return transactionEvent.transaction === 'POST /messages';
7782
});
7883
const promptTransactionPromise = waitForTransaction('node-express', transactionEvent => {
79-
return transactionEvent.transaction === 'mcp-server/prompt:echo';
84+
return transactionEvent.transaction === 'prompts/get echo';
8085
});
8186

8287
const promptResult = await client.getPrompt({
@@ -100,10 +105,12 @@ test('Should record transactions for mcp handlers', async ({ baseURL }) => {
100105

101106
const postTransaction = await postTransactionPromise;
102107
expect(postTransaction).toBeDefined();
108+
expect(postTransaction.contexts?.trace?.op).toEqual('http.server');
103109

104110
const promptTransaction = await promptTransactionPromise;
105111
expect(promptTransaction).toBeDefined();
106-
112+
expect(promptTransaction.contexts?.trace?.op).toEqual('mcp.server');
113+
expect(promptTransaction.contexts?.trace?.data?.['mcp.method.name']).toEqual('prompts/get');
107114
// TODO: When https://github.com/modelcontextprotocol/typescript-sdk/pull/358 is released check for trace id equality between the post transaction and the handler transaction
108115
});
109116
});

0 commit comments

Comments
 (0)