pull/715/head
Travis Fischer 2025-06-07 02:46:59 +07:00
rodzic 8cb6dca4ee
commit 148f36d37e
4 zmienionych plików z 37 dodań i 8 usunięć

Wyświetl plik

@ -30,8 +30,10 @@ for (const [i, fixtureSuite] of fixtureSuites.entries()) {
headers: expectedHeaders,
body: expectedBody
} = fixture.response ?? {}
const { snapshot = status >= 200 && status < 300 } =
fixture.response ?? {}
const snapshot =
fixture.response?.snapshot ??
fixtureSuite.snapshot ??
(status >= 200 && status < 300)
const debugFixture = !!(fixture.debug ?? fixtureSuite.debug)
let testFn = fixture.only ? test.only : test

Wyświetl plik

@ -47,6 +47,9 @@ export type E2ETestFixtureSuite = {
/** @default false */
debug?: boolean
/** @default undefined */
snapshot?: boolean
}
const now = Date.now()
@ -354,7 +357,6 @@ export const fixtureSuites: E2ETestFixtureSuite[] = [
{
title: 'Basic MCP origin "add" tool call success',
compareResponseBodies: true,
// debug: true,
fixtures: [
{
path: '@dev/test-basic-mcp/add',
@ -385,8 +387,7 @@ export const fixtureSuites: E2ETestFixtureSuite[] = [
},
{
title: 'Basic MCP origin "echo" tool call success',
only: true,
debug: true,
snapshot: false,
fixtures: [
{
path: '@dev/test-basic-mcp/echo',
@ -394,12 +395,38 @@ export const fixtureSuites: E2ETestFixtureSuite[] = [
method: 'POST',
json: {
nala: 'kitten',
num: 123,
now
}
},
response: {
body: [
{ type: 'text', text: JSON.stringify({ nala: 'kitten', now }) }
{
type: 'text',
text: JSON.stringify({ nala: 'kitten', num: 123, now })
}
]
}
},
{
path: '@dev/test-basic-mcp/echo',
request: {
searchParams: {
nala: 'kitten',
num: 123,
now
}
},
response: {
body: [
{
type: 'text',
text: JSON.stringify({
nala: 'kitten',
num: '123',
now: `${now}`
})
}
]
}
}

Wyświetl plik

@ -32,7 +32,7 @@ export function updateOriginRequest(
// }
// Delete all Cloudflare headers since we want origin requests to be agnostic
// to Agentic's choice of API gateway hosting provider.
// to Agentic's choice of hosting provider.
for (const headerKey of Object.keys(
Object.fromEntries(originRequest.headers.entries())
)) {

Wyświetl plik

@ -24,7 +24,7 @@ server.addTool({
server.addTool({
name: 'echo',
description: 'Echos back the input parameters.',
description: 'Echoes back the input parameters.',
parameters: z.record(z.string(), z.any()),
execute: async (args) => {
return JSON.stringify(args)