mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-17 15:53:23 +02:00
Merge pull request #3200 from cliffhall/roots-is-optional
Everything server - Fix error when referring to roots
This commit is contained in:
@@ -30,7 +30,7 @@ export const roots: Map<string | undefined, Root[]> = new Map<
|
|||||||
*/
|
*/
|
||||||
export const syncRoots = async (server: McpServer, sessionId?: string) => {
|
export const syncRoots = async (server: McpServer, sessionId?: string) => {
|
||||||
const clientCapabilities = server.server.getClientCapabilities() || {};
|
const clientCapabilities = server.server.getClientCapabilities() || {};
|
||||||
const clientSupportsRoots: boolean = clientCapabilities.roots !== undefined;
|
const clientSupportsRoots: boolean = clientCapabilities?.roots !== undefined;
|
||||||
|
|
||||||
// Fetch the roots list for this client
|
// Fetch the roots list for this client
|
||||||
if (clientSupportsRoots) {
|
if (clientSupportsRoots) {
|
||||||
@@ -48,7 +48,7 @@ export const syncRoots = async (server: McpServer, sessionId?: string) => {
|
|||||||
{
|
{
|
||||||
level: "info",
|
level: "info",
|
||||||
logger: "everything-server",
|
logger: "everything-server",
|
||||||
data: `Roots updated: ${response.roots.length} root(s) received from client`,
|
data: `Roots updated: ${response?.roots?.length} root(s) received from client`,
|
||||||
},
|
},
|
||||||
sessionId
|
sessionId
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user