fix: accept standard tools list metadata

This commit is contained in:
cadenli
2026-08-24 22:27:31 -03:00
committed by Alex Schmitt
parent 06ac5b8a49
commit c5ea82f6bf
2 changed files with 56 additions and 2 deletions
+10 -2
View File
@@ -423,8 +423,16 @@ function createMemoryMcpService(options = {}) {
return jsonRpcResult(message.id, {});
}
if (message.method === 'tools/list') {
if (message.params && Object.keys(message.params).length > 0) {
return jsonRpcError(message.id, -32602, 'tools/list does not accept parameters.');
const params = message.params || {};
if (
(Object.prototype.hasOwnProperty.call(params, '_meta') && !isRecord(params._meta))
|| (
Object.prototype.hasOwnProperty.call(params, 'cursor')
&& typeof params.cursor !== 'string'
)
|| Object.keys(params).some(key => !['cursor', '_meta'].includes(key))
) {
return jsonRpcError(message.id, -32602, 'Invalid tools/list parameters.');
}
return jsonRpcResult(message.id, {
tools: TOOL_DEFINITIONS.map(tool => ({ ...tool })),