@1mcp/agent 0.35.0-beta.2 → 0.35.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/build/admin/assets/admin-AboutRuntimeWorkspace-CM2ZafTJ.js +1 -0
- package/build/admin/assets/admin-BackendLogsWorkspace-CvJs1npx.js +1 -0
- package/build/admin/assets/admin-OAuthServicesWorkspace-BswG57Gm.js +1 -0
- package/build/admin/assets/admin-PresetAuthoringWorkspace-BIIRs_EN.js +1 -0
- package/build/admin/assets/admin-console-Brz9bnhv.css +1 -0
- package/build/admin/assets/{admin-console-C5_zD_qW.css → admin-console-DmRyrCWD.css} +1 -1
- package/build/admin/assets/admin-console-MT8QZmIC.js +3 -0
- package/build/admin/assets/admin-icons-D-JtMXSq.js +1 -0
- package/build/admin/assets/admin-mantine-DSFdoMaN.js +53 -0
- package/build/admin/assets/admin-react-BSaWeqgv.js +8 -0
- package/build/admin/assets/admin-rolldown-runtime-Bh1tDfsg.js +1 -0
- package/build/admin/favicon.svg +4 -0
- package/build/admin/index.html +8 -2
- package/build/auth/oauthAuthorizationFlow.d.ts +2 -2
- package/build/auth/oauthAuthorizationFlow.d.ts.map +1 -1
- package/build/auth/oauthAuthorizationFlow.js +1 -1
- package/build/auth/oauthAuthorizationFlow.js.map +1 -1
- package/build/auth/sdkOAuthServerProvider.d.ts +4 -3
- package/build/auth/sdkOAuthServerProvider.d.ts.map +1 -1
- package/build/auth/sdkOAuthServerProvider.js +132 -17
- package/build/auth/sdkOAuthServerProvider.js.map +1 -1
- package/build/auth/sessionTypes.d.ts +42 -5
- package/build/auth/sessionTypes.d.ts.map +1 -1
- package/build/auth/sessionTypes.js +33 -1
- package/build/auth/sessionTypes.js.map +1 -1
- package/build/auth/storage/fileStorageService.d.ts +18 -1
- package/build/auth/storage/fileStorageService.d.ts.map +1 -1
- package/build/auth/storage/fileStorageService.js +253 -3
- package/build/auth/storage/fileStorageService.js.map +1 -1
- package/build/auth/storage/oauthStorageService.d.ts +4 -1
- package/build/auth/storage/oauthStorageService.d.ts.map +1 -1
- package/build/auth/storage/oauthStorageService.js +8 -1
- package/build/auth/storage/oauthStorageService.js.map +1 -1
- package/build/auth/storage/refreshTokenFamilyRepository.d.ts +36 -0
- package/build/auth/storage/refreshTokenFamilyRepository.d.ts.map +1 -0
- package/build/auth/storage/refreshTokenFamilyRepository.js +167 -0
- package/build/auth/storage/refreshTokenFamilyRepository.js.map +1 -0
- package/build/auth/storage/sessionRepository.d.ts +14 -1
- package/build/auth/storage/sessionRepository.d.ts.map +1 -1
- package/build/auth/storage/sessionRepository.js +32 -9
- package/build/auth/storage/sessionRepository.js.map +1 -1
- package/build/commands/inspect/inspect.d.ts +1 -0
- package/build/commands/inspect/inspect.d.ts.map +1 -1
- package/build/commands/inspect/inspect.js +6 -10
- package/build/commands/inspect/inspect.js.map +1 -1
- package/build/commands/inspect/inspectUtils.d.ts +4 -0
- package/build/commands/inspect/inspectUtils.d.ts.map +1 -1
- package/build/commands/inspect/inspectUtils.js +12 -0
- package/build/commands/inspect/inspectUtils.js.map +1 -1
- package/build/commands/instructions/instructionsUtils.d.ts +2 -0
- package/build/commands/instructions/instructionsUtils.d.ts.map +1 -1
- package/build/commands/instructions/instructionsUtils.js +7 -3
- package/build/commands/instructions/instructionsUtils.js.map +1 -1
- package/build/commands/proxy/proxy.d.ts.map +1 -1
- package/build/commands/proxy/proxy.js +2 -0
- package/build/commands/proxy/proxy.js.map +1 -1
- package/build/commands/run/run.d.ts +1 -0
- package/build/commands/run/run.d.ts.map +1 -1
- package/build/commands/run/run.js +90 -8
- package/build/commands/run/run.js.map +1 -1
- package/build/commands/serve/asyncLoadingOptions.d.ts +30 -0
- package/build/commands/serve/asyncLoadingOptions.d.ts.map +1 -0
- package/build/commands/serve/asyncLoadingOptions.js +34 -0
- package/build/commands/serve/asyncLoadingOptions.js.map +1 -0
- package/build/commands/serve/index.d.ts +14 -1
- package/build/commands/serve/index.d.ts.map +1 -1
- package/build/commands/serve/index.js +24 -15
- package/build/commands/serve/index.js.map +1 -1
- package/build/commands/serve/serve.d.ts +5 -1
- package/build/commands/serve/serve.d.ts.map +1 -1
- package/build/commands/serve/serve.js +37 -8
- package/build/commands/serve/serve.js.map +1 -1
- package/build/commands/serve/serveBackground.d.ts.map +1 -1
- package/build/commands/serve/serveBackground.js +3 -0
- package/build/commands/serve/serveBackground.js.map +1 -1
- package/build/commands/serve/templateContextTrust.d.ts +12 -0
- package/build/commands/serve/templateContextTrust.d.ts.map +1 -0
- package/build/commands/serve/templateContextTrust.js +23 -0
- package/build/commands/serve/templateContextTrust.js.map +1 -0
- package/build/commands/shared/apiClient.d.ts +4 -1
- package/build/commands/shared/apiClient.d.ts.map +1 -1
- package/build/commands/shared/apiClient.js +8 -2
- package/build/commands/shared/apiClient.js.map +1 -1
- package/build/commands/shared/clientSurfaceAttachment.d.ts +14 -1
- package/build/commands/shared/clientSurfaceAttachment.d.ts.map +1 -1
- package/build/commands/shared/clientSurfaceAttachment.js +78 -10
- package/build/commands/shared/clientSurfaceAttachment.js.map +1 -1
- package/build/commands/shared/commandRunner.d.ts +1 -0
- package/build/commands/shared/commandRunner.d.ts.map +1 -1
- package/build/commands/shared/commandRunner.js +10 -2
- package/build/commands/shared/commandRunner.js.map +1 -1
- package/build/commands/shared/filterSelectionQuery.d.ts +8 -0
- package/build/commands/shared/filterSelectionQuery.d.ts.map +1 -0
- package/build/commands/shared/filterSelectionQuery.js +12 -0
- package/build/commands/shared/filterSelectionQuery.js.map +1 -0
- package/build/commands/shared/inspectApiSchemas.d.ts +83 -0
- package/build/commands/shared/inspectApiSchemas.d.ts.map +1 -0
- package/build/commands/shared/inspectApiSchemas.js +40 -0
- package/build/commands/shared/inspectApiSchemas.js.map +1 -0
- package/build/commands/shared/serveClient.d.ts +2 -1
- package/build/commands/shared/serveClient.d.ts.map +1 -1
- package/build/commands/shared/serveClient.js +3 -1
- package/build/commands/shared/serveClient.js.map +1 -1
- package/build/commands/shared/serveTargetResolver.d.ts +4 -0
- package/build/commands/shared/serveTargetResolver.d.ts.map +1 -1
- package/build/commands/shared/serveTargetResolver.js +25 -9
- package/build/commands/shared/serveTargetResolver.js.map +1 -1
- package/build/commands/wait/index.d.ts +3 -0
- package/build/commands/wait/index.d.ts.map +1 -0
- package/build/commands/wait/index.js +20 -0
- package/build/commands/wait/index.js.map +1 -0
- package/build/commands/wait/wait.d.ts +39 -0
- package/build/commands/wait/wait.d.ts.map +1 -0
- package/build/commands/wait/wait.js +162 -0
- package/build/commands/wait/wait.js.map +1 -0
- package/build/config/configLoader.d.ts.map +1 -1
- package/build/config/configLoader.js +12 -0
- package/build/config/configLoader.js.map +1 -1
- package/build/constants/auth.d.ts +10 -1
- package/build/constants/auth.d.ts.map +1 -1
- package/build/constants/auth.js +11 -1
- package/build/constants/auth.js.map +1 -1
- package/build/constants/mcp.d.ts +7 -1
- package/build/constants/mcp.d.ts.map +1 -1
- package/build/constants/mcp.js +9 -1
- package/build/constants/mcp.js.map +1 -1
- package/build/core/capabilities/capabilityAggregator.d.ts.map +1 -1
- package/build/core/capabilities/capabilityAggregator.js +10 -9
- package/build/core/capabilities/capabilityAggregator.js.map +1 -1
- package/build/core/capabilities/capabilityCatalog.d.ts +28 -5
- package/build/core/capabilities/capabilityCatalog.d.ts.map +1 -1
- package/build/core/capabilities/capabilityCatalog.js +98 -23
- package/build/core/capabilities/capabilityCatalog.js.map +1 -1
- package/build/core/capabilities/capabilityPagination.d.ts +40 -0
- package/build/core/capabilities/capabilityPagination.d.ts.map +1 -0
- package/build/core/capabilities/capabilityPagination.js +285 -0
- package/build/core/capabilities/capabilityPagination.js.map +1 -0
- package/build/core/capabilities/capabilityVisibility.d.ts +13 -0
- package/build/core/capabilities/capabilityVisibility.d.ts.map +1 -0
- package/build/core/capabilities/capabilityVisibility.js +14 -0
- package/build/core/capabilities/capabilityVisibility.js.map +1 -0
- package/build/core/capabilities/internalCapabilitiesProvider.d.ts +2 -1
- package/build/core/capabilities/internalCapabilitiesProvider.d.ts.map +1 -1
- package/build/core/capabilities/internalCapabilitiesProvider.js +2 -2
- package/build/core/capabilities/internalCapabilitiesProvider.js.map +1 -1
- package/build/core/capabilities/lazyLoadingOrchestrator.d.ts +5 -23
- package/build/core/capabilities/lazyLoadingOrchestrator.d.ts.map +1 -1
- package/build/core/capabilities/lazyLoadingOrchestrator.js +25 -44
- package/build/core/capabilities/lazyLoadingOrchestrator.js.map +1 -1
- package/build/core/capabilities/metaToolProvider.d.ts +6 -21
- package/build/core/capabilities/metaToolProvider.d.ts.map +1 -1
- package/build/core/capabilities/metaToolProvider.js +18 -70
- package/build/core/capabilities/metaToolProvider.js.map +1 -1
- package/build/core/capabilities/toolRegistry.d.ts +5 -1
- package/build/core/capabilities/toolRegistry.d.ts.map +1 -1
- package/build/core/capabilities/toolRegistry.js +11 -3
- package/build/core/capabilities/toolRegistry.js.map +1 -1
- package/build/core/client/clientManager.d.ts +9 -0
- package/build/core/client/clientManager.d.ts.map +1 -1
- package/build/core/client/clientManager.js +87 -0
- package/build/core/client/clientManager.js.map +1 -1
- package/build/core/client/recreateHttpTransportOptions.d.ts +14 -0
- package/build/core/client/recreateHttpTransportOptions.d.ts.map +1 -0
- package/build/core/client/recreateHttpTransportOptions.js +2 -0
- package/build/core/client/recreateHttpTransportOptions.js.map +1 -0
- package/build/core/client/transportRecreator.d.ts +8 -1
- package/build/core/client/transportRecreator.d.ts.map +1 -1
- package/build/core/client/transportRecreator.js +11 -2
- package/build/core/client/transportRecreator.js.map +1 -1
- package/build/core/context/templateContextTrust.d.ts +66 -0
- package/build/core/context/templateContextTrust.d.ts.map +1 -0
- package/build/core/context/templateContextTrust.js +184 -0
- package/build/core/context/templateContextTrust.js.map +1 -0
- package/build/core/instructions/templateTypes.d.ts +2 -2
- package/build/core/instructions/templateTypes.d.ts.map +1 -1
- package/build/core/protocol/notificationHandlers.d.ts.map +1 -1
- package/build/core/protocol/notificationHandlers.js +26 -4
- package/build/core/protocol/notificationHandlers.js.map +1 -1
- package/build/core/protocol/promptRequestHandlers.d.ts.map +1 -1
- package/build/core/protocol/promptRequestHandlers.js +20 -11
- package/build/core/protocol/promptRequestHandlers.js.map +1 -1
- package/build/core/protocol/requestHandlerUtils.d.ts +7 -0
- package/build/core/protocol/requestHandlerUtils.d.ts.map +1 -1
- package/build/core/protocol/requestHandlerUtils.js +43 -7
- package/build/core/protocol/requestHandlerUtils.js.map +1 -1
- package/build/core/protocol/resourceRequestHandlers.d.ts.map +1 -1
- package/build/core/protocol/resourceRequestHandlers.js +38 -18
- package/build/core/protocol/resourceRequestHandlers.js.map +1 -1
- package/build/core/protocol/toolRequestHandlers.d.ts.map +1 -1
- package/build/core/protocol/toolRequestHandlers.js +73 -30
- package/build/core/protocol/toolRequestHandlers.js.map +1 -1
- package/build/core/runtime/runtimeIdentityService.d.ts +1 -0
- package/build/core/runtime/runtimeIdentityService.d.ts.map +1 -1
- package/build/core/runtime/runtimeIdentityService.js +4 -1
- package/build/core/runtime/runtimeIdentityService.js.map +1 -1
- package/build/core/server/agentConfig.d.ts +4 -0
- package/build/core/server/agentConfig.d.ts.map +1 -1
- package/build/core/server/agentConfig.js +3 -0
- package/build/core/server/agentConfig.js.map +1 -1
- package/build/core/server/clientInstanceFactory.d.ts.map +1 -1
- package/build/core/server/clientInstanceFactory.js +12 -3
- package/build/core/server/clientInstanceFactory.js.map +1 -1
- package/build/core/server/connectionManager.d.ts +0 -6
- package/build/core/server/connectionManager.d.ts.map +1 -1
- package/build/core/server/connectionManager.js +2 -39
- package/build/core/server/connectionManager.js.map +1 -1
- package/build/core/server/connectionResolver.d.ts.map +1 -1
- package/build/core/server/connectionResolver.js +35 -1
- package/build/core/server/connectionResolver.js.map +1 -1
- package/build/core/server/requestContextPreparation.d.ts +2 -1
- package/build/core/server/requestContextPreparation.d.ts.map +1 -1
- package/build/core/server/requestContextPreparation.js.map +1 -1
- package/build/core/server/runtimeScopeOwnership.js +1 -1
- package/build/core/server/runtimeScopeOwnership.js.map +1 -1
- package/build/core/server/templateServerManager.d.ts.map +1 -1
- package/build/core/server/templateServerManager.js +2 -0
- package/build/core/server/templateServerManager.js.map +1 -1
- package/build/core/tools/internal/schemas/discovery.d.ts +1 -1
- package/build/core/tools/internal/schemas/index.d.ts +7 -7
- package/build/core/tools/internal/schemas/installation.d.ts +3 -3
- package/build/core/tools/internal/schemas/management.d.ts +3 -3
- package/build/core/types/server.d.ts +2 -0
- package/build/core/types/server.d.ts.map +1 -1
- package/build/core/types/server.js.map +1 -1
- package/build/core/types/transport.d.ts +12 -0
- package/build/core/types/transport.d.ts.map +1 -1
- package/build/core/types/transport.js +23 -5
- package/build/core/types/transport.js.map +1 -1
- package/build/domains/admin/adminConfiguredServerService.d.ts +80 -0
- package/build/domains/admin/adminConfiguredServerService.d.ts.map +1 -1
- package/build/domains/admin/adminConfiguredServerService.js +507 -1
- package/build/domains/admin/adminConfiguredServerService.js.map +1 -1
- package/build/domains/backend-logs/backendLogBroker.d.ts +47 -0
- package/build/domains/backend-logs/backendLogBroker.d.ts.map +1 -0
- package/build/domains/backend-logs/backendLogBroker.js +249 -0
- package/build/domains/backend-logs/backendLogBroker.js.map +1 -0
- package/build/domains/backend-logs/backendLogProjection.d.ts +9 -0
- package/build/domains/backend-logs/backendLogProjection.d.ts.map +1 -0
- package/build/domains/backend-logs/backendLogProjection.js +40 -0
- package/build/domains/backend-logs/backendLogProjection.js.map +1 -0
- package/build/domains/backend-logs/backendLogRuntime.d.ts +4 -0
- package/build/domains/backend-logs/backendLogRuntime.d.ts.map +1 -0
- package/build/domains/backend-logs/backendLogRuntime.js +11 -0
- package/build/domains/backend-logs/backendLogRuntime.js.map +1 -0
- package/build/domains/backend-logs/backendLogSanitizer.d.ts +2 -0
- package/build/domains/backend-logs/backendLogSanitizer.d.ts.map +1 -0
- package/build/domains/backend-logs/backendLogSanitizer.js +30 -0
- package/build/domains/backend-logs/backendLogSanitizer.js.map +1 -0
- package/build/domains/backend-logs/backendLogSource.d.ts +8 -0
- package/build/domains/backend-logs/backendLogSource.d.ts.map +1 -0
- package/build/domains/backend-logs/backendLogSource.js +22 -0
- package/build/domains/backend-logs/backendLogSource.js.map +1 -0
- package/build/domains/backend-logs/backendLogTypes.d.ts +49 -0
- package/build/domains/backend-logs/backendLogTypes.d.ts.map +1 -0
- package/build/domains/backend-logs/backendLogTypes.js +2 -0
- package/build/domains/backend-logs/backendLogTypes.js.map +1 -0
- package/build/domains/config-change/configChange.d.ts +2 -1
- package/build/domains/config-change/configChange.d.ts.map +1 -1
- package/build/domains/config-change/configChange.js +88 -0
- package/build/domains/config-change/configChange.js.map +1 -1
- package/build/domains/config-change/types.d.ts +5 -1
- package/build/domains/config-change/types.d.ts.map +1 -1
- package/build/domains/installation/serverInstallationSourceResolution.js +2 -0
- package/build/domains/installation/serverInstallationSourceResolution.js.map +1 -1
- package/build/domains/installation/serverInstallationTypes.d.ts +8 -0
- package/build/domains/installation/serverInstallationTypes.d.ts.map +1 -1
- package/build/domains/installation/serverInstallationWorkflow.js +16 -3
- package/build/domains/installation/serverInstallationWorkflow.js.map +1 -1
- package/build/domains/runtime-targets/runtimeIdentityVerification.d.ts +8 -1
- package/build/domains/runtime-targets/runtimeIdentityVerification.d.ts.map +1 -1
- package/build/domains/runtime-targets/runtimeIdentityVerification.js +62 -3
- package/build/domains/runtime-targets/runtimeIdentityVerification.js.map +1 -1
- package/build/domains/runtime-targets/runtimeProbe.d.ts +34 -0
- package/build/domains/runtime-targets/runtimeProbe.d.ts.map +1 -0
- package/build/domains/runtime-targets/runtimeProbe.js +71 -0
- package/build/domains/runtime-targets/runtimeProbe.js.map +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build/transport/http/middlewares/httpRequestLogger.d.ts.map +1 -1
- package/build/transport/http/middlewares/httpRequestLogger.js +3 -2
- package/build/transport/http/middlewares/httpRequestLogger.js.map +1 -1
- package/build/transport/http/routes/adminRoutes.d.ts +2 -0
- package/build/transport/http/routes/adminRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/adminRoutes.js +288 -31
- package/build/transport/http/routes/adminRoutes.js.map +1 -1
- package/build/transport/http/routes/inspectHelpers.d.ts +11 -4
- package/build/transport/http/routes/inspectHelpers.d.ts.map +1 -1
- package/build/transport/http/routes/inspectHelpers.js +21 -2
- package/build/transport/http/routes/inspectHelpers.js.map +1 -1
- package/build/transport/http/routes/inspectRequestContext.d.ts.map +1 -1
- package/build/transport/http/routes/inspectRequestContext.js +13 -4
- package/build/transport/http/routes/inspectRequestContext.js.map +1 -1
- package/build/transport/http/routes/inspectRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/inspectRoutes.js +55 -4
- package/build/transport/http/routes/inspectRoutes.js.map +1 -1
- package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/streamableHttpRoutes.js +13 -4
- package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
- package/build/transport/http/routes/toolRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/toolRoutes.js +37 -29
- package/build/transport/http/routes/toolRoutes.js.map +1 -1
- package/build/transport/http/server.d.ts.map +1 -1
- package/build/transport/http/server.js +3 -1
- package/build/transport/http/server.js.map +1 -1
- package/build/transport/http/storage/streamableSessionRepository.d.ts.map +1 -1
- package/build/transport/http/storage/streamableSessionRepository.js +2 -0
- package/build/transport/http/storage/streamableSessionRepository.js.map +1 -1
- package/build/transport/http/streamableSessionLifecycle.d.ts +3 -1
- package/build/transport/http/streamableSessionLifecycle.d.ts.map +1 -1
- package/build/transport/http/streamableSessionLifecycle.js +23 -6
- package/build/transport/http/streamableSessionLifecycle.js.map +1 -1
- package/build/transport/http/utils/contextExtractor.d.ts +14 -16
- package/build/transport/http/utils/contextExtractor.d.ts.map +1 -1
- package/build/transport/http/utils/contextExtractor.js +124 -33
- package/build/transport/http/utils/contextExtractor.js.map +1 -1
- package/build/transport/http/utils/templateContextAuthority.d.ts +13 -0
- package/build/transport/http/utils/templateContextAuthority.d.ts.map +1 -0
- package/build/transport/http/utils/templateContextAuthority.js +121 -0
- package/build/transport/http/utils/templateContextAuthority.js.map +1 -0
- package/build/transport/managedStdioStderr.d.ts +17 -1
- package/build/transport/managedStdioStderr.d.ts.map +1 -1
- package/build/transport/managedStdioStderr.js +129 -5
- package/build/transport/managedStdioStderr.js.map +1 -1
- package/build/transport/managedStdioStderrOptions.d.ts +2 -0
- package/build/transport/managedStdioStderrOptions.d.ts.map +1 -1
- package/build/transport/restartableStdioTransport.js +1 -1
- package/build/transport/restartableStdioTransport.js.map +1 -1
- package/build/transport/stdioProxyTransport.d.ts +3 -0
- package/build/transport/stdioProxyTransport.d.ts.map +1 -1
- package/build/transport/stdioProxyTransport.js +7 -2
- package/build/transport/stdioProxyTransport.js.map +1 -1
- package/build/transport/transportFactory.d.ts +6 -2
- package/build/transport/transportFactory.d.ts.map +1 -1
- package/build/transport/transportFactory.js +43 -15
- package/build/transport/transportFactory.js.map +1 -1
- package/build/types/serverStatus.d.ts +3 -0
- package/build/types/serverStatus.d.ts.map +1 -0
- package/build/types/serverStatus.js +13 -0
- package/build/types/serverStatus.js.map +1 -0
- package/build/utils/validation/urlDetection.d.ts +12 -9
- package/build/utils/validation/urlDetection.d.ts.map +1 -1
- package/build/utils/validation/urlDetection.js +233 -31
- package/build/utils/validation/urlDetection.js.map +1 -1
- package/package.json +4 -3
- package/build/admin/assets/admin-console-CbHHoqLr.js +0 -61
- package/build/utils/ui/pagination.d.ts +0 -35
- package/build/utils/ui/pagination.d.ts.map +0 -1
- package/build/utils/ui/pagination.js +0 -166
- package/build/utils/ui/pagination.js.map +0 -1
|
@@ -61,12 +61,12 @@ export interface LazyLoadingState {
|
|
|
61
61
|
/** Whether lazy loading is enabled */
|
|
62
62
|
enabled: boolean;
|
|
63
63
|
/** Lazy loading mode */
|
|
64
|
-
mode: 'metatool' | '
|
|
64
|
+
mode: 'metatool' | 'full';
|
|
65
65
|
/** Total number of tools available across all servers */
|
|
66
66
|
availableToolsCount: number;
|
|
67
67
|
/** Number of tools exposed via tools/list (varies by mode) */
|
|
68
68
|
exposedToolsCount: number;
|
|
69
|
-
/** Number of tools
|
|
69
|
+
/** Number of directly exposed tools (always zero when lazy loading is enabled) */
|
|
70
70
|
directExposeCount: number;
|
|
71
71
|
/** Number of tools currently cached with schemas */
|
|
72
72
|
cachedToolsCount: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateTypes.d.ts","sourceRoot":"","sources":["../../../src/core/instructions/templateTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IAEb,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;IAErB,2CAA2C;IAC3C,eAAe,EAAE,OAAO,CAAC;IAEzB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAEhC,wGAAwG;IACxG,WAAW,EAAE,MAAM,CAAC;IAEpB,wFAAwF;IACxF,wBAAwB,EAAE,MAAM,CAAC;IAEjC,+EAA+E;IAC/E,oBAAoB,EAAE,MAAM,CAAC;IAE7B,wEAAwE;IACxE,UAAU,EAAE,OAAO,CAAC;IAEpB,wEAAwE;IACxE,uBAAuB,EAAE,OAAO,CAAC;IAEjC,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IAEnB,yDAAyD;IACzD,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB,oEAAoE;IACpE,OAAO,EAAE,UAAU,EAAE,CAAC;IAEtB,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IAEtB,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IAEd,4DAA4D;IAC5D,sBAAsB,EAAE,MAAM,CAAC;IAE/B,oDAAoD;IACpD,cAAc,EAAE,MAAM,CAAC;IAGvB,uDAAuD;IACvD,YAAY,EAA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AEG;AACH,MAAM,WAAW,cAAc;IAC7B,wCAAwC;IACxC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;IAE7B,oDAAoD;IACpD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,eAAe,EAatD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAKpF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,q4JAyIjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notificationHandlers.d.ts","sourceRoot":"","sources":["../../../src/core/protocol/notificationHandlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notificationHandlers.d.ts","sourceRoot":"","sources":["../../../src/core/protocol/notificationHandlers.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,iBAAiB,EAAE,mBAAmB,EAAgB,MAAM,0BAA0B,CAAC;AAI9G;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,mBAAmB,EAClC,WAAW,EAAE,iBAAiB,GAC7B,IAAI,CAyEN;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,aAAa,EAAE,mBAAmB,EAClC,WAAW,EAAE,iBAAiB,GAC7B,IAAI,CA8CN"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CancelledNotificationSchema, LoggingMessageNotificationSchema, ProgressNotificationSchema,
|
|
1
|
+
import { CancelledNotificationSchema, LoggingMessageNotificationSchema, ProgressNotificationSchema, ResourceUpdatedNotificationSchema, RootsListChangedNotificationSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { registerCapabilityPaginationNotifications } from '../../core/capabilities/capabilityPagination.js';
|
|
2
3
|
import { ClientStatus, ServerStatus } from '../../core/types/index.js';
|
|
3
4
|
import logger from '../../logger/logger.js';
|
|
4
5
|
import { withErrorHandling } from '../../utils/core/errorHandling.js';
|
|
@@ -13,11 +14,32 @@ export function setupClientToServerNotifications(outboundConns, inboundConn) {
|
|
|
13
14
|
ProgressNotificationSchema,
|
|
14
15
|
LoggingMessageNotificationSchema,
|
|
15
16
|
ResourceUpdatedNotificationSchema,
|
|
16
|
-
ResourceListChangedNotificationSchema,
|
|
17
|
-
ToolListChangedNotificationSchema,
|
|
18
|
-
PromptListChangedNotificationSchema,
|
|
19
17
|
];
|
|
20
18
|
for (const [name, outboundConn] of outboundConns.entries()) {
|
|
19
|
+
registerCapabilityPaginationNotifications(outboundConns, outboundConn, inboundConn, withErrorHandling(async (notification) => {
|
|
20
|
+
logger.info(`Received notification in client: ${name} ${JSON.stringify(notification)}`);
|
|
21
|
+
if (inboundConn.status !== ServerStatus.Connected || !inboundConn.server.transport) {
|
|
22
|
+
logger.warn(`Server transport not connected. Dropping notification from ${name}`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
await inboundConn.server.notification({
|
|
27
|
+
method: notification.method,
|
|
28
|
+
params: {
|
|
29
|
+
...notification.params,
|
|
30
|
+
server: name,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
if (error instanceof Error && error.message.includes('Not connected')) {
|
|
36
|
+
logger.warn(`Server transport not connected. Dropping notification from ${name}`);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
logger.error(`Failed to send notification from ${name}: ${error}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, `Error handling client notification from ${name}`));
|
|
21
43
|
clientNotificationSchemas.forEach((schema) => {
|
|
22
44
|
outboundConn.client.setNotificationHandler(schema, withErrorHandling(async (notification) => {
|
|
23
45
|
logger.info(`Received notification in client: ${name} ${JSON.stringify(notification)}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notificationHandlers.js","sourceRoot":"","sources":["../../../src/core/protocol/notificationHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,EAChC,0BAA0B,EAC1B,
|
|
1
|
+
{"version":3,"file":"notificationHandlers.js","sourceRoot":"","sources":["../../../src/core/protocol/notificationHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,EAChC,0BAA0B,EAC1B,iCAAiC,EACjC,kCAAkC,GACnC,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,yCAAyC,EAAE,MAAM,gDAAgD,CAAC;AAC3G,OAAO,EAAE,YAAY,EAA0C,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC9G,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE;;;;GAIG;AACH,MAAM,UAAU,gCAAgC,CAC9C,aAAkC,EAClC,WAA8B;IAE9B,MAAM,yBAAyB,GAAG;QAChC,2BAA2B;QAC3B,0BAA0B;QAC1B,gCAAgC;QAChC,iCAAiC;KAClC,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC;QAC3D,yCAAyC,CACvC,aAAa,EACb,YAAY,EACZ,WAAW,EACX,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;YACvC,MAAM,CAAC,IAAI,CAAC,oCAAoC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;YAExF,IAAI,WAAW,CAAC,MAAM,KAAK,YAAY,CAAC,SAAS,IAAI,CAAC,WAAW,CAAC,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Y,CAAC,EAAE,CAAC,CAAC;gBACxF,IAAI,YAAY,CAAC,MAAM,KAAK,YAAY,CAAC,SAAS,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;oBACrF,MAAM,CAAC,IAAI,CAAC,UAAU,IAAI,2CAA2C,CAAC,CAAC;oBACvE,OAAO;gBACT,CAAC;gBAED,+DAA+D;gBAC/D,IAAI,CAAC;oBACH,6DAA6D;oBAC7D,MAAM,qBAAqB,GAAG;wBAC5B,MAAM,EAAE,YAAY,CAAC,MAAM;wBAC3B,MAAM,EAAE;4BACN,GAAG,YAAY,CAAC,MAAM;4BACtB,MAAM,EAAE,IAAI;yBACb;qBACF,CAAC;oBACF,MAAM,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;gBAChE,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;wBACtE,MAAM,CAAC,IAAI,CAAC,UAAU,IAAI,kDAAkD,CAAC,CAAC;oBAChF,CAAC;yBAAM,CAAC;wBACN,MAAM,CAAC,KAAK,CAAC,kCAAkC,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;oBACnE,CAAC;gBACH,CAAC;YACH,CAAC,EAAE,yCAAyC,IAAI,EAAE,CAAC,CACpD,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptRequestHandlers.d.ts","sourceRoot":"","sources":["../../../src/core/protocol/promptRequestHandlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"promptRequestHandlers.d.ts","sourceRoot":"","sources":["../../../src/core/protocol/promptRequestHandlers.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAYlF,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAoD/G;AAED,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI,CAkCnH"}
|
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
import { CompleteRequestSchema, GetPromptRequestSchema, ListPromptsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
import { MCP_URI_SEPARATOR } from '../../constants.js';
|
|
3
|
-
import { byCapabilities } from '../../core/filtering/clientFiltering.js';
|
|
4
|
-
import { FilteringService } from '../../core/filtering/filteringService.js';
|
|
5
3
|
import { withErrorHandling } from '../../utils/core/errorHandling.js';
|
|
6
4
|
import { buildUri, parseUri } from '../../utils/core/parsing.js';
|
|
7
5
|
import { getRequestTimeout } from '../../utils/core/timeoutUtils.js';
|
|
8
|
-
import {
|
|
9
|
-
import { filterConnectionsForSession, getRequestSession, resolveOutboundConnection } from './requestHandlerUtils.js';
|
|
6
|
+
import { createProtocolCapabilityCatalog, getRequestSession, resolveCapabilityVisibility, resolveOutboundConnection, } from './requestHandlerUtils.js';
|
|
10
7
|
export function registerPromptHandlers(outboundConns, inboundConn) {
|
|
11
8
|
const sessionId = getRequestSession(inboundConn);
|
|
9
|
+
const catalog = createProtocolCapabilityCatalog(outboundConns);
|
|
12
10
|
inboundConn.server.setRequestHandler(ListPromptsRequestSchema, withErrorHandling(async (request) => {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
const visibility = resolveCapabilityVisibility(outboundConns, inboundConn, sessionId, 'prompts');
|
|
12
|
+
const result = await catalog.listVisibleCapabilityPages({
|
|
13
|
+
kind: 'prompts',
|
|
14
|
+
visibility,
|
|
15
|
+
cursor: request.params?.cursor,
|
|
16
|
+
list: async (outboundConn, cursor, serverName) => {
|
|
17
|
+
const upstream = await outboundConn.client.listPrompts({ cursor }, { timeout: getRequestTimeout(outboundConn.transport) });
|
|
18
|
+
return {
|
|
19
|
+
items: (upstream.prompts ?? []).map((prompt) => ({
|
|
20
|
+
...prompt,
|
|
21
|
+
name: buildUri(serverName, prompt.name, MCP_URI_SEPARATOR),
|
|
22
|
+
})),
|
|
23
|
+
nextCursor: upstream.nextCursor,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
enablePagination: inboundConn.enablePagination ?? false,
|
|
27
|
+
});
|
|
20
28
|
return {
|
|
21
29
|
prompts: result.items,
|
|
22
30
|
nextCursor: result.nextCursor,
|
|
31
|
+
_meta: result._meta,
|
|
23
32
|
};
|
|
24
33
|
}, 'Error listing prompts'));
|
|
25
34
|
inboundConn.server.setRequestHandler(GetPromptRequestSchema, withErrorHandling(async (request) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promptRequestHandlers.js","sourceRoot":"","sources":["../../../src/core/protocol/promptRequestHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EACrB,sBAAsB,EAEtB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"promptRequestHandlers.js","sourceRoot":"","sources":["../../../src/core/protocol/promptRequestHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EACrB,sBAAsB,EAEtB,wBAAwB,GAEzB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EACL,+BAA+B,EAC/B,iBAAiB,EACjB,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC;AAElC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AAiB,CAAC,CAAC;YAC/E,UAAU,GAAG,EAAE,CAAC;YAChB,UAAU,GAAG,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;QAC9C,CAAC;aAAM,IAAI,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACvC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,YAAY,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;YAC9E,UAAU,GAAG,EAAE,CAAC;YAChB,UAAU,GAAG,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC;QAC7C,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,0CAA2C,GAAwB,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9F,CAAC;QAED,MAAM,YAAY,GAAG,yBAAyB,CAAC,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;QAClG,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,mBAAmB,UAAU,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,YAAY,CAAC,MAAM,CAAC,QAAQ,CACjC,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,EACtC;YACE,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,SAAS,CAAC;SACnD,CACF,CAAC;IACJ,CAAC,EAAE,2BAA2B,CAAC,CAChC,CAAC;AACJ,CAAC"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { CapabilityCatalog } from '../../core/capabilities/capabilityCatalog.js';
|
|
2
|
+
import { type CapabilityVisibility } from '../../core/capabilities/capabilityVisibility.js';
|
|
2
3
|
import { InboundConnection, OutboundConnection, OutboundConnections } from '../../core/types/index.js';
|
|
3
4
|
import type { MCPServerParams } from '../../core/types/transport.js';
|
|
4
5
|
export declare function getRequestSession(inboundConn: InboundConnection): string | undefined;
|
|
5
6
|
export declare function createCapabilityCatalogFromConnections(connections: OutboundConnections, getServerConfigs?: () => Record<string, MCPServerParams>): Promise<CapabilityCatalog>;
|
|
7
|
+
/** Create the runtime Capability Catalog used by protocol capability walks. */
|
|
8
|
+
export declare function createProtocolCapabilityCatalog(connections: OutboundConnections, getServerConfigs?: () => Record<string, MCPServerParams>): CapabilityCatalog;
|
|
6
9
|
export declare function resolveOutboundConnection(clientName: string, sessionId: string | undefined, outboundConns: OutboundConnections, inboundConn?: InboundConnection): OutboundConnection | undefined;
|
|
7
10
|
export declare function filterConnectionsForSession(outboundConns: OutboundConnections, sessionId: string | undefined): OutboundConnections;
|
|
11
|
+
/** Resolve request-time Filter Selection into a Server Candidate Set. */
|
|
12
|
+
export declare function resolveLazyCapabilityVisibility(outboundConns: OutboundConnections, inboundConn: InboundConnection, sessionId: string | undefined): CapabilityVisibility;
|
|
13
|
+
/** Resolve request-time Filter Selection into a catalog-enforced Server Candidate Set. */
|
|
14
|
+
export declare function resolveCapabilityVisibility(outboundConns: OutboundConnections, inboundConn: InboundConnection, sessionId: string | undefined, capability: 'tools' | 'resources' | 'prompts'): CapabilityVisibility;
|
|
8
15
|
//# sourceMappingURL=requestHandlerUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlerUtils.d.ts","sourceRoot":"","sources":["../../../src/core/protocol/requestHandlerUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"requestHandlerUtils.d.ts","sourceRoot":"","sources":["../../../src/core/protocol/requestHandlerUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,KAAK,oBAAoB,EAA8B,MAAM,gDAAgD,CAAC;AAOvH,OAAO,EAAgB,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIpE,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAEpF;AAED,wBAAsB,sCAAsC,CAC1D,WAAW,EAAE,mBAAmB,EAChC,gBAAgB,GAAE,MAAM,MAAM,CAAC,MAAM,EAAE,eAAe,CAA6D,GAClH,OAAO,CAAC,iBAAiB,CAAC,CAkC5B;AAED,+EAA+E;AAC/E,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,mBAAmB,EAChC,gBAAgB,GAAE,MAAM,MAAM,CAAC,MAAM,EAAE,eAAe,CAA6D,GAClH,iBAAiB,CAOnB;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,aAAa,EAAE,mBAAmB,EAClC,WAAW,CAAC,EAAE,iBAAiB,GAC9B,kBAAkB,GAAG,SAAS,CAMhC;AAED,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,mBAAmB,EAClC,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,mBAAmB,CAIrB;AAED,yEAAyE;AACzE,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,mBAAmB,EAClC,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,oBAAoB,CAEtB;AAED,0FAA0F;AAC1F,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,mBAAmB,EAClC,WAAW,EAAE,iBAAiB,EAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS,GAC5C,oBAAoB,CAsBtB"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { McpConfigManager } from '../../config/mcpConfigManager.js';
|
|
2
2
|
import { CapabilityCatalog } from '../../core/capabilities/capabilityCatalog.js';
|
|
3
|
+
import { createCapabilityVisibility } from '../../core/capabilities/capabilityVisibility.js';
|
|
3
4
|
import { SchemaCache } from '../../core/capabilities/schemaCache.js';
|
|
4
5
|
import { ToolRegistry } from '../../core/capabilities/toolRegistry.js';
|
|
6
|
+
import { byCapabilities } from '../../core/filtering/clientFiltering.js';
|
|
5
7
|
import { FilteringService } from '../../core/filtering/filteringService.js';
|
|
6
8
|
import { createConnectionResolver } from '../../core/server/connectionResolver.js';
|
|
7
9
|
import { ServerManager } from '../../core/server/serverManager.js';
|
|
8
10
|
import { ClientStatus } from '../../core/types/index.js';
|
|
11
|
+
import logger from '../../logger/logger.js';
|
|
9
12
|
import { getRequestTimeout } from '../../utils/core/timeoutUtils.js';
|
|
10
13
|
export function getRequestSession(inboundConn) {
|
|
11
14
|
return inboundConn.context?.sessionId;
|
|
@@ -17,13 +20,18 @@ export async function createCapabilityCatalogFromConnections(connections, getSer
|
|
|
17
20
|
if (connection.status !== ClientStatus.Connected)
|
|
18
21
|
return;
|
|
19
22
|
const serverName = connection.name || (connectionKey.includes(':') ? connectionKey.split(':')[0] : connectionKey);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
try {
|
|
24
|
+
const result = await connection.client.listTools(undefined, {
|
|
25
|
+
timeout: getRequestTimeout(connection.transport),
|
|
26
|
+
});
|
|
27
|
+
toolsByServer.set(serverName, result.tools ?? []);
|
|
28
|
+
tagsByServer.set(serverName, Array.isArray(connection.transport.tags)
|
|
29
|
+
? connection.transport.tags.filter((tag) => typeof tag === 'string')
|
|
30
|
+
: []);
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
logger.warn(`Failed to list tools from ${serverName}`, { error: String(error) });
|
|
34
|
+
}
|
|
27
35
|
}));
|
|
28
36
|
return new CapabilityCatalog({
|
|
29
37
|
getToolRegistry: () => ToolRegistry.fromToolsMap(toolsByServer, tagsByServer),
|
|
@@ -33,6 +41,15 @@ export async function createCapabilityCatalogFromConnections(connections, getSer
|
|
|
33
41
|
templateHashProvider: ServerManager.current.getTemplateServerManager(),
|
|
34
42
|
});
|
|
35
43
|
}
|
|
44
|
+
/** Create the runtime Capability Catalog used by protocol capability walks. */
|
|
45
|
+
export function createProtocolCapabilityCatalog(connections, getServerConfigs = () => McpConfigManager.getInstance().getTransportConfig()) {
|
|
46
|
+
return new CapabilityCatalog({
|
|
47
|
+
getToolRegistry: ToolRegistry.empty,
|
|
48
|
+
schemaCache: new SchemaCache({ maxEntries: 100 }),
|
|
49
|
+
outboundConnections: connections,
|
|
50
|
+
getServerConfigs,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
36
53
|
export function resolveOutboundConnection(clientName, sessionId, outboundConns, inboundConn) {
|
|
37
54
|
const scopedConns = filterConnectionsForSession(outboundConns, sessionId);
|
|
38
55
|
const filteredConns = inboundConn ? FilteringService.getFilteredConnections(scopedConns, inboundConn) : scopedConns;
|
|
@@ -45,4 +62,23 @@ export function filterConnectionsForSession(outboundConns, sessionId) {
|
|
|
45
62
|
const resolver = createConnectionResolver(outboundConns, templateServerManager);
|
|
46
63
|
return resolver.filterForSession(sessionId);
|
|
47
64
|
}
|
|
65
|
+
/** Resolve request-time Filter Selection into a Server Candidate Set. */
|
|
66
|
+
export function resolveLazyCapabilityVisibility(outboundConns, inboundConn, sessionId) {
|
|
67
|
+
return resolveCapabilityVisibility(outboundConns, inboundConn, sessionId, 'tools');
|
|
68
|
+
}
|
|
69
|
+
/** Resolve request-time Filter Selection into a catalog-enforced Server Candidate Set. */
|
|
70
|
+
export function resolveCapabilityVisibility(outboundConns, inboundConn, sessionId, capability) {
|
|
71
|
+
// Scope template instances before applying client filters and availability.
|
|
72
|
+
const sessionScoped = filterConnectionsForSession(outboundConns, sessionId);
|
|
73
|
+
const tagAndPresetScoped = FilteringService.getFilteredConnections(sessionScoped, inboundConn);
|
|
74
|
+
const capabilityRequirement = capability === 'tools' ? { tools: {} } : capability === 'resources' ? { resources: {} } : { prompts: {} };
|
|
75
|
+
const capable = byCapabilities(capabilityRequirement)(tagAndPresetScoped);
|
|
76
|
+
return createCapabilityVisibility(Array.from(capable.entries(), ([connectionKey, connection]) => [connectionKey, connection.name || connectionKey.split(':')[0]]), sessionId, {
|
|
77
|
+
tagFilterMode: inboundConn.tagFilterMode,
|
|
78
|
+
tags: inboundConn.tags,
|
|
79
|
+
tagExpression: inboundConn.tagExpression,
|
|
80
|
+
tagQuery: inboundConn.tagQuery,
|
|
81
|
+
presetName: inboundConn.presetName,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
48
84
|
//# sourceMappingURL=requestHandlerUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestHandlerUtils.js","sourceRoot":"","sources":["../../../src/core/protocol/requestHandlerUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,YAAY,EAA8D,MAAM,0BAA0B,CAAC;AAEpH,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,MAAM,UAAU,iBAAiB,CAAC,WAA8B;IAC9D,OAAO,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,sCAAsC,CAC1D,WAAgC,EAChC,mBAA0D,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,EAAE,CAA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EAAE,CAAC;IAC5G,MAAM,OAAO,GAAG,cAAc,CAAC,qBAAqB,CAAC,CAAC,kBAAkB,CAAC,CAAC;IAE1E,OAAO,0BAA0B,CAC/B,KAAK,CAAC,IAAI,CACR,OAAO,CAAC,OAAO,EAAE,EACjB,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,EAAE,UAAU,CAAC,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAU,CAC1G,EACD,SAAS,EACT;QACE,aAAa,EAAE,WAAW,CAAC,aAAa;QACxC,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,aAAa,EAAE,WAAW,CAAC,aAAa;QACxC,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,UAAU,EAAE,WAAW,CAAC,UAAU;KACnC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceRequestHandlers.d.ts","sourceRoot":"","sources":["../../../src/core/protocol/resourceRequestHandlers.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"resourceRequestHandlers.d.ts","sourceRoot":"","sources":["../../../src/core/protocol/resourceRequestHandlers.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAYlF,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,iBAAiB,GAAG,IAAI,CA8HjH"}
|
|
@@ -1,38 +1,58 @@
|
|
|
1
1
|
import { ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, SubscribeRequestSchema, UnsubscribeRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
2
2
|
import { MCP_URI_SEPARATOR } from '../../constants.js';
|
|
3
|
-
import { byCapabilities } from '../../core/filtering/clientFiltering.js';
|
|
4
|
-
import { FilteringService } from '../../core/filtering/filteringService.js';
|
|
5
3
|
import { withErrorHandling } from '../../utils/core/errorHandling.js';
|
|
6
4
|
import { buildUri, parseUri } from '../../utils/core/parsing.js';
|
|
7
5
|
import { getRequestTimeout } from '../../utils/core/timeoutUtils.js';
|
|
8
|
-
import {
|
|
9
|
-
import { filterConnectionsForSession, getRequestSession, resolveOutboundConnection } from './requestHandlerUtils.js';
|
|
6
|
+
import { createProtocolCapabilityCatalog, getRequestSession, resolveCapabilityVisibility, resolveOutboundConnection, } from './requestHandlerUtils.js';
|
|
10
7
|
export function registerResourceHandlers(outboundConns, inboundConn) {
|
|
11
8
|
const sessionId = getRequestSession(inboundConn);
|
|
9
|
+
const catalog = createProtocolCapabilityCatalog(outboundConns);
|
|
12
10
|
inboundConn.server.setRequestHandler(ListResourcesRequestSchema, withErrorHandling(async (request) => {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
const visibility = resolveCapabilityVisibility(outboundConns, inboundConn, sessionId, 'resources');
|
|
12
|
+
const result = await catalog.listVisibleCapabilityPages({
|
|
13
|
+
kind: 'resources',
|
|
14
|
+
visibility,
|
|
15
|
+
cursor: request.params?.cursor,
|
|
16
|
+
list: async (outboundConn, cursor, serverName) => {
|
|
17
|
+
const upstream = await outboundConn.client.listResources({ cursor }, { timeout: getRequestTimeout(outboundConn.transport) });
|
|
18
|
+
return {
|
|
19
|
+
items: (upstream.resources ?? []).map((resource) => ({
|
|
20
|
+
...resource,
|
|
21
|
+
uri: buildUri(serverName, resource.uri, MCP_URI_SEPARATOR),
|
|
22
|
+
})),
|
|
23
|
+
nextCursor: upstream.nextCursor,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
enablePagination: inboundConn.enablePagination ?? false,
|
|
27
|
+
});
|
|
20
28
|
return {
|
|
21
29
|
resources: result.items,
|
|
22
30
|
nextCursor: result.nextCursor,
|
|
31
|
+
_meta: result._meta,
|
|
23
32
|
};
|
|
24
33
|
}, 'Error listing resources'));
|
|
25
34
|
inboundConn.server.setRequestHandler(ListResourceTemplatesRequestSchema, withErrorHandling(async (request) => {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
const visibility = resolveCapabilityVisibility(outboundConns, inboundConn, sessionId, 'resources');
|
|
36
|
+
const result = await catalog.listVisibleCapabilityPages({
|
|
37
|
+
kind: 'resourceTemplates',
|
|
38
|
+
visibility,
|
|
39
|
+
cursor: request.params?.cursor,
|
|
40
|
+
list: async (outboundConn, cursor, serverName) => {
|
|
41
|
+
const upstream = await outboundConn.client.listResourceTemplates({ cursor }, { timeout: getRequestTimeout(outboundConn.transport) });
|
|
42
|
+
return {
|
|
43
|
+
items: (upstream.resourceTemplates ?? []).map((template) => ({
|
|
44
|
+
...template,
|
|
45
|
+
uriTemplate: buildUri(serverName, template.uriTemplate, MCP_URI_SEPARATOR),
|
|
46
|
+
})),
|
|
47
|
+
nextCursor: upstream.nextCursor,
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
enablePagination: inboundConn.enablePagination ?? false,
|
|
51
|
+
});
|
|
33
52
|
return {
|
|
34
53
|
resourceTemplates: result.items,
|
|
35
54
|
nextCursor: result.nextCursor,
|
|
55
|
+
_meta: result._meta,
|
|
36
56
|
};
|
|
37
57
|
}, 'Error listing resource templates'));
|
|
38
58
|
inboundConn.server.setRequestHandler(SubscribeRequestSchema, withErrorHandling(async (request) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceRequestHandlers.js","sourceRoot":"","sources":["../../../src/core/protocol/resourceRequestHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,EAE1B,kCAAkC,EAClC,yBAAyB,
|
|
1
|
+
{"version":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C;QAEF,OAAO;YACL,GAAG,QAAQ;YACX,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC5C,GAAG,OAAO;gBACV,GAAG,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,iBAAiB,CAAC;aACjE,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC,EAAE,wBAAwB,CAAC,CAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolRequestHandlers.d.ts","sourceRoot":"","sources":["../../../src/core/protocol/toolRequestHandlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toolRequestHandlers.d.ts","sourceRoot":"","sources":["../../../src/core/protocol/toolRequestHandlers.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAE5F,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAelF,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,mBAAmB,EAClC,WAAW,EAAE,iBAAiB,EAC9B,uBAAuB,CAAC,EAAE,uBAAuB,GAChD,IAAI,CA6KN"}
|
|
@@ -2,32 +2,27 @@ import { CallToolRequestSchema, CallToolResultSchema, ListToolsRequestSchema, }
|
|
|
2
2
|
import { McpConfigManager } from '../../config/mcpConfigManager.js';
|
|
3
3
|
import { MCP_URI_SEPARATOR } from '../../constants.js';
|
|
4
4
|
import { InternalCapabilitiesProvider } from '../../core/capabilities/internalCapabilitiesProvider.js';
|
|
5
|
-
import { byCapabilities } from '../../core/filtering/clientFiltering.js';
|
|
6
|
-
import { FilteringService } from '../../core/filtering/filteringService.js';
|
|
7
5
|
import { getDisabledToolError } from '../../core/server/disabledTools.js';
|
|
8
6
|
import logger, { infoIf } from '../../logger/logger.js';
|
|
9
7
|
import { withErrorHandling } from '../../utils/core/errorHandling.js';
|
|
10
8
|
import { buildUri, parseUri } from '../../utils/core/parsing.js';
|
|
11
9
|
import { getRequestTimeout } from '../../utils/core/timeoutUtils.js';
|
|
12
|
-
import {
|
|
10
|
+
import { createProtocolCapabilityCatalog, getRequestSession, resolveCapabilityVisibility, resolveLazyCapabilityVisibility, resolveOutboundConnection, } from './requestHandlerUtils.js';
|
|
13
11
|
export function registerToolHandlers(outboundConns, inboundConn, lazyLoadingOrchestrator) {
|
|
14
12
|
const sessionId = getRequestSession(inboundConn);
|
|
15
13
|
const lazyLoadingEnabled = lazyLoadingOrchestrator?.isEnabled();
|
|
16
14
|
const getServerConfigs = () => McpConfigManager.getInstance().getTransportConfig();
|
|
15
|
+
const catalog = createProtocolCapabilityCatalog(outboundConns, getServerConfigs);
|
|
17
16
|
inboundConn.server.setRequestHandler(ListToolsRequestSchema, withErrorHandling(async (request) => {
|
|
18
17
|
if (lazyLoadingEnabled && lazyLoadingOrchestrator) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const filteredClients = FilteringService.getFilteredConnections(capabilityFilteredClients, inboundConn);
|
|
22
|
-
const filteredServerNames = new Set(Array.from(filteredClients.values()).map((conn) => conn.name));
|
|
18
|
+
const visibility = resolveLazyCapabilityVisibility(outboundConns, inboundConn, sessionId);
|
|
19
|
+
const visibleServerNames = Array.from(new Set(visibility.serverCandidates.values()));
|
|
23
20
|
infoIf(() => ({
|
|
24
21
|
message: 'Lazy loading: filtered servers',
|
|
25
22
|
meta: {
|
|
26
23
|
totalOutbound: outboundConns.size,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
finalFiltered: filteredClients.size,
|
|
30
|
-
filteredServerNames: Array.from(filteredServerNames),
|
|
24
|
+
finalFiltered: visibility.serverCandidates.size,
|
|
25
|
+
visibleServerNames,
|
|
31
26
|
inboundConfig: {
|
|
32
27
|
tagFilterMode: inboundConn.tagFilterMode,
|
|
33
28
|
tags: inboundConn.tags,
|
|
@@ -35,40 +30,76 @@ export function registerToolHandlers(outboundConns, inboundConn, lazyLoadingOrch
|
|
|
35
30
|
},
|
|
36
31
|
},
|
|
37
32
|
}));
|
|
38
|
-
const capabilities = await lazyLoadingOrchestrator.
|
|
33
|
+
const capabilities = await lazyLoadingOrchestrator.getCapabilitiesForVisibility(visibility);
|
|
39
34
|
const internalProvider = InternalCapabilitiesProvider.getInstance();
|
|
40
35
|
await internalProvider.initialize();
|
|
41
36
|
const internalTools = internalProvider.getAvailableTools();
|
|
42
37
|
const lazyToolNames = ['tool_list', 'tool_schema', 'tool_invoke'];
|
|
43
38
|
const nonLazyTools = internalTools.filter((tool) => !lazyToolNames.includes(tool.name));
|
|
39
|
+
const paginationFacts = createToolPaginationFacts(internalTools, getServerConfigs());
|
|
44
40
|
const internalToolsWithPrefix = nonLazyTools.map((tool) => ({
|
|
45
41
|
...tool,
|
|
46
42
|
name: buildUri('1mcp', tool.name, MCP_URI_SEPARATOR),
|
|
47
43
|
}));
|
|
44
|
+
const tools = [...capabilities.tools, ...internalToolsWithPrefix].sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
45
|
+
const result = await catalog.listVisibleCapabilityPages({
|
|
46
|
+
kind: 'tools',
|
|
47
|
+
visibility,
|
|
48
|
+
cursor: request.params?.cursor,
|
|
49
|
+
list: async () => ({ items: [] }),
|
|
50
|
+
internalPages: [{ id: '\0app.1mcp/lazy-tools', name: '1mcp', items: tools }],
|
|
51
|
+
includeExternal: false,
|
|
52
|
+
filterSelection: { lazy: true, ...paginationFacts },
|
|
53
|
+
generationSignature: paginationFacts,
|
|
54
|
+
enablePagination: inboundConn.enablePagination ?? false,
|
|
55
|
+
});
|
|
48
56
|
return {
|
|
49
|
-
tools:
|
|
57
|
+
tools: result.items,
|
|
58
|
+
nextCursor: result.nextCursor,
|
|
59
|
+
_meta: result._meta,
|
|
50
60
|
};
|
|
51
61
|
}
|
|
52
|
-
const
|
|
53
|
-
const capabilityFilteredClients = byCapabilities({ tools: {} })(sessionFilteredConns);
|
|
54
|
-
const filteredClients = FilteringService.getFilteredConnections(capabilityFilteredClients, inboundConn);
|
|
55
|
-
const catalog = await createCapabilityCatalogFromConnections(filteredClients, getServerConfigs);
|
|
56
|
-
const result = await catalog.listVisibleTools(request.params || {}, sessionId);
|
|
62
|
+
const visibility = resolveCapabilityVisibility(outboundConns, inboundConn, sessionId, 'tools');
|
|
57
63
|
const internalProvider = InternalCapabilitiesProvider.getInstance();
|
|
58
64
|
await internalProvider.initialize();
|
|
59
65
|
const internalTools = internalProvider.getAvailableTools();
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
const serverConfigs = getServerConfigs();
|
|
67
|
+
const paginationFacts = createToolPaginationFacts(internalTools, serverConfigs);
|
|
68
|
+
const result = await catalog.listVisibleCapabilityPages({
|
|
69
|
+
kind: 'tools',
|
|
70
|
+
visibility,
|
|
71
|
+
cursor: request.params?.cursor,
|
|
72
|
+
list: async (outboundConn, cursor) => {
|
|
73
|
+
const upstream = await outboundConn.client.listTools({ cursor }, { timeout: getRequestTimeout(outboundConn.transport) });
|
|
74
|
+
return {
|
|
75
|
+
items: upstream.tools ?? [],
|
|
76
|
+
nextCursor: upstream.nextCursor,
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
mapItem: (tool, serverName) => ({
|
|
80
|
+
...tool,
|
|
81
|
+
name: buildUri(serverName, tool.name, MCP_URI_SEPARATOR),
|
|
82
|
+
inputSchema: tool.inputSchema ?? { type: 'object' },
|
|
83
|
+
}),
|
|
84
|
+
internalPages: [
|
|
85
|
+
{
|
|
86
|
+
id: '\0app.1mcp/internal-tools',
|
|
87
|
+
name: '1mcp',
|
|
88
|
+
items: internalTools.map((tool) => ({
|
|
89
|
+
...tool,
|
|
90
|
+
name: buildUri('1mcp', tool.name, MCP_URI_SEPARATOR),
|
|
91
|
+
})),
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
filterSelection: paginationFacts,
|
|
95
|
+
generationSignature: paginationFacts,
|
|
96
|
+
serverConfigs,
|
|
97
|
+
enablePagination: inboundConn.enablePagination ?? false,
|
|
98
|
+
});
|
|
69
99
|
return {
|
|
70
|
-
tools:
|
|
100
|
+
tools: result.items,
|
|
71
101
|
nextCursor: result.nextCursor,
|
|
102
|
+
_meta: result._meta,
|
|
72
103
|
};
|
|
73
104
|
}, 'Error listing tools'));
|
|
74
105
|
inboundConn.server.setRequestHandler(CallToolRequestSchema, withErrorHandling(async (request) => {
|
|
@@ -77,7 +108,8 @@ export function registerToolHandlers(outboundConns, inboundConn, lazyLoadingOrch
|
|
|
77
108
|
if (isUnprefixedMetaTool && lazyLoadingOrchestrator) {
|
|
78
109
|
let result;
|
|
79
110
|
try {
|
|
80
|
-
|
|
111
|
+
const visibility = resolveLazyCapabilityVisibility(outboundConns, inboundConn, sessionId);
|
|
112
|
+
result = await lazyLoadingOrchestrator.callMetaTool(toolName, request.params.arguments, visibility);
|
|
81
113
|
}
|
|
82
114
|
catch (metaToolError) {
|
|
83
115
|
logger.error(`Meta-tool ${toolName} execution failed: ${metaToolError}`);
|
|
@@ -97,7 +129,10 @@ export function registerToolHandlers(outboundConns, inboundConn, lazyLoadingOrch
|
|
|
97
129
|
if (clientName === '1mcp') {
|
|
98
130
|
const internalProvider = InternalCapabilitiesProvider.getInstance();
|
|
99
131
|
await internalProvider.initialize();
|
|
100
|
-
const
|
|
132
|
+
const visibility = lazyLoadingEnabled
|
|
133
|
+
? resolveLazyCapabilityVisibility(outboundConns, inboundConn, sessionId)
|
|
134
|
+
: undefined;
|
|
135
|
+
const result = await internalProvider.executeTool(extractedToolName, request.params.arguments, visibility);
|
|
101
136
|
return structuredToolResult(result);
|
|
102
137
|
}
|
|
103
138
|
const outboundConn = resolveOutboundConnection(clientName, sessionId, outboundConns, inboundConn);
|
|
@@ -118,6 +153,14 @@ export function registerToolHandlers(outboundConns, inboundConn, lazyLoadingOrch
|
|
|
118
153
|
});
|
|
119
154
|
}, 'Error calling tool'));
|
|
120
155
|
}
|
|
156
|
+
function createToolPaginationFacts(internalTools, serverConfigs) {
|
|
157
|
+
return {
|
|
158
|
+
disabledTools: Object.fromEntries(Object.entries(serverConfigs)
|
|
159
|
+
.filter(([, config]) => config.disabledTools?.length)
|
|
160
|
+
.map(([name, config]) => [name, [...(config.disabledTools ?? [])].sort()])),
|
|
161
|
+
internalTools: internalTools.map((tool) => tool.name).sort(),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
121
164
|
function structuredToolResult(result) {
|
|
122
165
|
return {
|
|
123
166
|
content: [
|