mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-28 20:45:11 +02:00
fix(memory-mcp): accept the reserved _meta param on ping
tools/list and tools/call on main already admit `_meta` — MCP reserves it for request metadata and a client may attach it to any request. ping still refused every parameter, so a client that sends `_meta` on everything (Codex does) got -32602 on its keepalive. Rebased onto main and narrowed: when this branch was first written the same gap existed on tools/list, which has since been fixed upstream. Only the ping handler is left, so only the ping handler is touched. Refs #2810
This commit is contained in:
@@ -260,6 +260,7 @@ async function withClient(fn, options = {}) {
|
||||
{ name, arguments: toolArguments }
|
||||
),
|
||||
callToolRaw: params => request('tools/call', params),
|
||||
ping: params => request('ping', params),
|
||||
};
|
||||
phase = 'callback';
|
||||
await Promise.race([Promise.resolve().then(() => fn(client, fixture)), transportFailure]);
|
||||
@@ -393,6 +394,25 @@ async function main() {
|
||||
});
|
||||
});
|
||||
|
||||
await test('accepts the reserved _meta param on ping and rejects malformed values (#2810)', async () => {
|
||||
await withClient(async client => {
|
||||
assert.deepStrictEqual(await client.ping({ _meta: { progressToken: 'progress-1' } }), {});
|
||||
assert.deepStrictEqual(await client.ping(), {});
|
||||
assert.deepStrictEqual(await client.ping({}), {});
|
||||
|
||||
for (const badMeta of [null, ['not', 'an', 'object'], 'string', 42, true]) {
|
||||
await assert.rejects(
|
||||
client.ping({ _meta: badMeta }),
|
||||
/-32602/,
|
||||
`expected ping _meta=${JSON.stringify(badMeta)} to be rejected`
|
||||
);
|
||||
}
|
||||
|
||||
await assert.rejects(client.ping({ unexpected: true }), /-32602/);
|
||||
await assert.rejects(client.ping({ _meta: {}, unexpected: true }), /-32602/);
|
||||
});
|
||||
});
|
||||
|
||||
await test('accepts the reserved _meta param on tools/call and rejects malformed values', async () => {
|
||||
await withClient(async client => {
|
||||
// A valid `_meta` object (e.g. progressToken) must not block the tool call.
|
||||
|
||||
Reference in New Issue
Block a user