kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: add first e2e test for REST => MCP origin tool call
rodzic
e13308f801
commit
2b131ee901
|
@ -36,6 +36,15 @@ 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`] = `
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"text": "42",
|
||||||
|
"type": "text",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`Basic OpenAPI getPost success > 0.0: POST @dev/test-basic-openapi/getPost 1`] = `
|
exports[`Basic OpenAPI getPost success > 0.0: POST @dev/test-basic-openapi/getPost 1`] = `
|
||||||
{
|
{
|
||||||
"body": "quia et suscipit
|
"body": "quia et suscipit
|
||||||
|
|
|
@ -32,6 +32,7 @@ for (const [i, fixtureSuite] of fixtureSuites.entries()) {
|
||||||
} = fixture.response ?? {}
|
} = fixture.response ?? {}
|
||||||
const { snapshot = status >= 200 && status < 300 } =
|
const { snapshot = status >= 200 && status < 300 } =
|
||||||
fixture.response ?? {}
|
fixture.response ?? {}
|
||||||
|
const debugFixture = !!(fixture.debug ?? fixtureSuite.debug)
|
||||||
|
|
||||||
let testFn = fixture.only ? test.only : test
|
let testFn = fixture.only ? test.only : test
|
||||||
if (fixtureSuite.sequential) {
|
if (fixtureSuite.sequential) {
|
||||||
|
@ -94,10 +95,12 @@ for (const [i, fixtureSuite] of fixtureSuites.entries()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(`${i}.${j}: ${method} ${fixture.path} => ${status}`, {
|
if (debugFixture) {
|
||||||
// body,
|
console.log(`${i}.${j}: ${method} ${fixture.path} => ${status}`, {
|
||||||
// headers: Object.fromEntries(res.headers.entries())
|
body,
|
||||||
// })
|
headers: Object.fromEntries(res.headers.entries())
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,9 @@ export type E2ETestFixture = {
|
||||||
/** @default false */
|
/** @default false */
|
||||||
only?: boolean
|
only?: boolean
|
||||||
|
|
||||||
|
/** @default false */
|
||||||
|
debug?: boolean
|
||||||
|
|
||||||
request?: {
|
request?: {
|
||||||
/** @default 'GET' */
|
/** @default 'GET' */
|
||||||
method?: 'GET' | 'POST' | 'PUT' | 'DELETE'
|
method?: 'GET' | 'POST' | 'PUT' | 'DELETE'
|
||||||
|
@ -41,6 +44,9 @@ export type E2ETestFixtureSuite = {
|
||||||
|
|
||||||
/** @default false */
|
/** @default false */
|
||||||
compareResponseBodies?: boolean
|
compareResponseBodies?: boolean
|
||||||
|
|
||||||
|
/** @default false */
|
||||||
|
debug?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fixtureSuites: E2ETestFixtureSuite[] = [
|
export const fixtureSuites: E2ETestFixtureSuite[] = [
|
||||||
|
@ -342,20 +348,26 @@ export const fixtureSuites: E2ETestFixtureSuite[] = [
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Basic MCP origin tool call success',
|
||||||
|
compareResponseBodies: true,
|
||||||
|
only: true,
|
||||||
|
debug: true,
|
||||||
|
fixtures: [
|
||||||
|
{
|
||||||
|
path: '@dev/test-basic-mcp/add',
|
||||||
|
request: {
|
||||||
|
method: 'POST',
|
||||||
|
json: {
|
||||||
|
a: 22,
|
||||||
|
b: 20
|
||||||
|
}
|
||||||
|
},
|
||||||
|
response: {
|
||||||
|
body: [{ type: 'text', text: '42' }]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
// {
|
|
||||||
// title: 'Basic MCP origin tool call success',
|
|
||||||
// compareResponseBodies: true,
|
|
||||||
// fixtures: [
|
|
||||||
// {
|
|
||||||
// path: '@dev/test-basic-openapi@fc856666/get_post',
|
|
||||||
// request: {
|
|
||||||
// method: 'POST',
|
|
||||||
// json: {
|
|
||||||
// postId: 13
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
- add username / team name blacklist
|
- add username / team name blacklist
|
||||||
- admin, internal, mcp, sse, etc
|
- admin, internal, mcp, sse, etc
|
||||||
- API gateway
|
- API gateway
|
||||||
|
- `cfValidateJsonSchemaObject` relax object constraint for output validation
|
||||||
|
- tool call outputs might not be objects
|
||||||
|
- keep the object validation for tool input params
|
||||||
- public MCP interface
|
- public MCP interface
|
||||||
- MCP origin server support
|
- MCP origin server support
|
||||||
- add support for custom headers on responses
|
- add support for custom headers on responses
|
||||||
|
|
Ładowanie…
Reference in New Issue