pull/715/head
Travis Fischer 2025-06-07 02:25:54 +07:00
rodzic 68e8c14c0c
commit 77be33c482
3 zmienionych plików z 53 dodań i 12 usunięć

Wyświetl plik

@ -36,7 +36,16 @@ et est aut quod aut provident voluptas autem voluptas",
}
`;
exports[`Basic MCP origin tool call success > 5.0: POST @dev/test-basic-mcp/add 1`] = `
exports[`Basic MCP origin "add" tool call success > 5.0: POST @dev/test-basic-mcp/add 1`] = `
[
{
"text": "42",
"type": "text",
},
]
`;
exports[`Basic MCP origin "add" tool call success > 5.1: GET @dev/test-basic-mcp/add 1`] = `
[
{
"text": "42",

Wyświetl plik

@ -49,6 +49,8 @@ export type E2ETestFixtureSuite = {
debug?: boolean
}
// const now = Date.now()
export const fixtureSuites: E2ETestFixtureSuite[] = [
{
title: 'Basic OpenAPI getPost success',
@ -350,10 +352,9 @@ export const fixtureSuites: E2ETestFixtureSuite[] = [
]
},
{
title: 'Basic MCP origin tool call success',
title: 'Basic MCP origin "add" tool call success',
compareResponseBodies: true,
only: true,
debug: true,
// debug: true,
fixtures: [
{
path: '@dev/test-basic-mcp/add',
@ -367,7 +368,41 @@ export const fixtureSuites: E2ETestFixtureSuite[] = [
response: {
body: [{ type: 'text', text: '42' }]
}
},
{
path: '@dev/test-basic-mcp/add',
request: {
searchParams: {
a: 22,
b: 20
}
},
response: {
body: [{ type: 'text', text: '42' }]
}
}
]
}
// {
// title: 'Basic MCP origin "echo" tool call success',
// only: true,
// // debug: true,
// fixtures: [
// {
// path: '@dev/test-basic-mcp/echo',
// request: {
// method: 'POST',
// json: {
// nala: 'kitten',
// now
// }
// },
// response: {
// body: [
// { type: 'text', text: JSON.stringify({ nala: 'kitten', now }) }
// ]
// }
// }
// ]
// }
]

Wyświetl plik

@ -12,7 +12,7 @@ const server = new FastMCP({
server.addTool({
name: 'add',
description: 'Add two numbers',
description: 'Add two numbers.',
parameters: z.object({
a: z.number(),
b: z.number()
@ -23,14 +23,11 @@ server.addTool({
})
server.addTool({
name: 'add2',
description: 'TODO',
parameters: z.object({
a: z.number(),
b: z.number()
}),
name: 'echo',
description: 'Echos back the input parameters.',
parameters: z.any(),
execute: async (args) => {
return String(args.a + args.b)
return JSON.stringify(args)
}
})