@1mcp/agent 0.35.0-beta.3 → 0.35.0
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/build/admin/assets/admin-AboutRuntimeWorkspace-DH2QC2nJ.js +1 -0
- package/build/admin/assets/admin-BackendLogsWorkspace-BKavXT9B.js +1 -0
- package/build/admin/assets/admin-InstructionTemplatesWorkspace-CvG4EPdZ.js +1 -0
- package/build/admin/assets/admin-OAuthServicesWorkspace-B8y2weAX.js +1 -0
- package/build/admin/assets/admin-PresetAuthoringWorkspace-BboJVBFl.js +1 -0
- package/build/admin/assets/admin-console-D6jyI73o.css +1 -0
- package/build/admin/assets/{admin-console-Bbil6BQU.css → admin-console-DmRyrCWD.css} +1 -1
- package/build/admin/assets/admin-console-HJH52xGP.js +3 -0
- package/build/admin/assets/admin-icons-CYGTDZA5.js +1 -0
- package/build/admin/assets/admin-mantine-xwbfu5Gd.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/sdkOAuthClientProvider.d.ts +4 -0
- package/build/auth/sdkOAuthClientProvider.d.ts.map +1 -1
- package/build/auth/sdkOAuthClientProvider.js +29 -0
- package/build/auth/sdkOAuthClientProvider.js.map +1 -1
- package/build/auth/sessionTypes.d.ts +2 -0
- package/build/auth/sessionTypes.d.ts.map +1 -1
- package/build/auth/sessionTypes.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 +4 -1
- package/build/commands/inspect/inspect.js.map +1 -1
- package/build/commands/instructions/instructions.d.ts.map +1 -1
- package/build/commands/instructions/instructions.js +56 -1
- package/build/commands/instructions/instructions.js.map +1 -1
- package/build/commands/mcp/add.js +2 -2
- package/build/commands/mcp/add.js.map +1 -1
- package/build/commands/mcp/list.js +1 -1
- package/build/commands/mcp/list.js.map +1 -1
- package/build/commands/mcp/update.js +1 -1
- package/build/commands/mcp/update.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 +4 -1
- package/build/commands/run/run.js.map +1 -1
- package/build/commands/serve/index.d.ts +10 -0
- package/build/commands/serve/index.d.ts.map +1 -1
- package/build/commands/serve/index.js +10 -0
- package/build/commands/serve/index.js.map +1 -1
- package/build/commands/serve/serve.d.ts +3 -0
- package/build/commands/serve/serve.d.ts.map +1 -1
- package/build/commands/serve/serve.js +20 -0
- 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 +2 -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 +3 -0
- package/build/commands/shared/apiClient.d.ts.map +1 -1
- package/build/commands/shared/apiClient.js +6 -0
- package/build/commands/shared/apiClient.js.map +1 -1
- package/build/commands/shared/clientSurfaceAttachment.d.ts +11 -0
- package/build/commands/shared/clientSurfaceAttachment.d.ts.map +1 -1
- package/build/commands/shared/clientSurfaceAttachment.js +64 -6
- package/build/commands/shared/clientSurfaceAttachment.js.map +1 -1
- package/build/commands/shared/inspectApiSchemas.d.ts +8 -8
- 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 +22 -22
- package/build/commands/shared/serveTargetResolver.js.map +1 -1
- package/build/commands/wait/wait.d.ts.map +1 -1
- package/build/commands/wait/wait.js +1 -0
- package/build/commands/wait/wait.js.map +1 -1
- package/build/config/configManager.d.ts +11 -1
- package/build/config/configManager.d.ts.map +1 -1
- package/build/config/configManager.js +13 -0
- package/build/config/configManager.js.map +1 -1
- package/build/config/configuredServerTargets.d.ts +3 -0
- package/build/config/configuredServerTargets.d.ts.map +1 -0
- package/build/config/configuredServerTargets.js +8 -0
- package/build/config/configuredServerTargets.js.map +1 -0
- package/build/config/mcpConfigManager.d.ts +3 -0
- package/build/config/mcpConfigManager.d.ts.map +1 -1
- package/build/config/mcpConfigManager.js +15 -0
- package/build/config/mcpConfigManager.js.map +1 -1
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.d.ts.map +1 -1
- package/build/constants/api.js +1 -0
- package/build/constants/api.js.map +1 -1
- package/build/constants/mcp.d.ts +1 -1
- package/build/constants/mcp.d.ts.map +1 -1
- package/build/constants/mcp.js +1 -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 +33 -14
- package/build/core/capabilities/capabilityAggregator.js.map +1 -1
- package/build/core/capabilities/capabilityCatalog.d.ts +23 -1
- package/build/core/capabilities/capabilityCatalog.d.ts.map +1 -1
- package/build/core/capabilities/capabilityCatalog.js +81 -7
- 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 +287 -0
- package/build/core/capabilities/capabilityPagination.js.map +1 -0
- package/build/core/capabilities/capabilityVisibility.d.ts +2 -1
- package/build/core/capabilities/capabilityVisibility.d.ts.map +1 -1
- package/build/core/capabilities/capabilityVisibility.js +2 -1
- package/build/core/capabilities/capabilityVisibility.js.map +1 -1
- package/build/core/capabilities/configuredToolSnapshot.d.ts +12 -0
- package/build/core/capabilities/configuredToolSnapshot.d.ts.map +1 -0
- package/build/core/capabilities/configuredToolSnapshot.js +98 -0
- package/build/core/capabilities/configuredToolSnapshot.js.map +1 -0
- package/build/core/capabilities/lazyLoadingOrchestrator.d.ts.map +1 -1
- package/build/core/capabilities/lazyLoadingOrchestrator.js +8 -4
- package/build/core/capabilities/lazyLoadingOrchestrator.js.map +1 -1
- package/build/core/capabilities/metaToolProvider.js +3 -3
- package/build/core/capabilities/metaToolProvider.js.map +1 -1
- package/build/core/client/clientManager.d.ts.map +1 -1
- package/build/core/client/clientManager.js +11 -6
- package/build/core/client/clientManager.js.map +1 -1
- package/build/core/client/postAuthOAuthRecovery.d.ts +6 -0
- package/build/core/client/postAuthOAuthRecovery.d.ts.map +1 -0
- package/build/core/client/postAuthOAuthRecovery.js +74 -0
- package/build/core/client/postAuthOAuthRecovery.js.map +1 -0
- package/build/core/configChangeHandler.d.ts +2 -0
- package/build/core/configChangeHandler.d.ts.map +1 -1
- package/build/core/configChangeHandler.js +38 -11
- package/build/core/configChangeHandler.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/effectiveServerInstructions.d.ts +17 -0
- package/build/core/instructions/effectiveServerInstructions.d.ts.map +1 -0
- package/build/core/instructions/effectiveServerInstructions.js +12 -0
- package/build/core/instructions/effectiveServerInstructions.js.map +1 -0
- package/build/core/instructions/instructionAggregator.d.ts +51 -2
- package/build/core/instructions/instructionAggregator.d.ts.map +1 -1
- package/build/core/instructions/instructionAggregator.js +191 -30
- package/build/core/instructions/instructionAggregator.js.map +1 -1
- package/build/core/instructions/instructionsDistribution.d.ts +53 -0
- package/build/core/instructions/instructionsDistribution.d.ts.map +1 -1
- package/build/core/instructions/instructionsDistribution.js +25 -0
- package/build/core/instructions/instructionsDistribution.js.map +1 -1
- package/build/core/instructions/templateTypes.d.ts +25 -3
- package/build/core/instructions/templateTypes.d.ts.map +1 -1
- package/build/core/instructions/templateTypes.js +45 -0
- package/build/core/instructions/templateTypes.js.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 +4 -0
- package/build/core/protocol/requestHandlerUtils.d.ts.map +1 -1
- package/build/core/protocol/requestHandlerUtils.js +24 -4
- 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 +79 -23
- package/build/core/protocol/toolRequestHandlers.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/clientInstancePool.js +2 -2
- package/build/core/server/clientInstancePool.js.map +1 -1
- package/build/core/server/connectionManager.d.ts.map +1 -1
- package/build/core/server/connectionManager.js +2 -0
- package/build/core/server/connectionManager.js.map +1 -1
- package/build/core/server/disabledTools.d.ts +2 -0
- package/build/core/server/disabledTools.d.ts.map +1 -1
- package/build/core/server/disabledTools.js +7 -4
- package/build/core/server/disabledTools.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/serverManager.d.ts.map +1 -1
- package/build/core/server/serverManager.js +1 -0
- package/build/core/server/serverManager.js.map +1 -1
- package/build/core/server/templateIdentity.d.ts +1 -0
- package/build/core/server/templateIdentity.d.ts.map +1 -1
- package/build/core/server/templateIdentity.js +11 -1
- package/build/core/server/templateIdentity.js.map +1 -1
- package/build/core/server/templateServerManager.d.ts +5 -1
- package/build/core/server/templateServerManager.d.ts.map +1 -1
- package/build/core/server/templateServerManager.js +27 -9
- package/build/core/server/templateServerManager.js.map +1 -1
- package/build/core/server/toolDescriptionOverrides.d.ts +9 -0
- package/build/core/server/toolDescriptionOverrides.d.ts.map +1 -0
- package/build/core/server/toolDescriptionOverrides.js +44 -0
- package/build/core/server/toolDescriptionOverrides.js.map +1 -0
- package/build/core/tools/handlers/serverManagementHandler.d.ts +15 -1
- package/build/core/tools/handlers/serverManagementHandler.d.ts.map +1 -1
- package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts +2 -0
- package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts.map +1 -1
- package/build/core/tools/internal/schemas/discovery.d.ts +2 -2
- package/build/core/tools/internal/schemas/index.d.ts +9 -9
- package/build/core/tools/internal/schemas/installation.d.ts +3 -3
- package/build/core/tools/internal/schemas/management.d.ts +4 -4
- 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 +43 -0
- package/build/core/types/transport.d.ts.map +1 -1
- package/build/core/types/transport.js +60 -1
- package/build/core/types/transport.js.map +1 -1
- package/build/domains/admin/adminConfiguredServerService.d.ts +131 -4
- package/build/domains/admin/adminConfiguredServerService.d.ts.map +1 -1
- package/build/domains/admin/adminConfiguredServerService.js +766 -39
- package/build/domains/admin/adminConfiguredServerService.js.map +1 -1
- package/build/domains/admin/adminDomain.d.ts +13 -0
- package/build/domains/admin/adminDomain.d.ts.map +1 -1
- package/build/domains/admin/adminDomain.js +16 -0
- package/build/domains/admin/adminDomain.js.map +1 -1
- package/build/domains/admin/adminInstructionPreviewRuntime.d.ts +7 -0
- package/build/domains/admin/adminInstructionPreviewRuntime.d.ts.map +1 -0
- package/build/domains/admin/adminInstructionPreviewRuntime.js +154 -0
- package/build/domains/admin/adminInstructionPreviewRuntime.js.map +1 -0
- package/build/domains/admin/adminInstructionTemplateService.d.ts +169 -0
- package/build/domains/admin/adminInstructionTemplateService.d.ts.map +1 -0
- package/build/domains/admin/adminInstructionTemplateService.js +181 -0
- package/build/domains/admin/adminInstructionTemplateService.js.map +1 -0
- package/build/domains/admin/configuredToolInventory.d.ts +46 -0
- package/build/domains/admin/configuredToolInventory.d.ts.map +1 -0
- package/build/domains/admin/configuredToolInventory.js +135 -0
- package/build/domains/admin/configuredToolInventory.js.map +1 -0
- package/build/domains/backend-logs/backendLogSource.d.ts.map +1 -1
- package/build/domains/backend-logs/backendLogSource.js.map +1 -1
- 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 +241 -13
- package/build/domains/config-change/configChange.js.map +1 -1
- package/build/domains/config-change/types.d.ts +34 -2
- 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/instruction-template/instructionTemplateManager.d.ts +58 -0
- package/build/domains/instruction-template/instructionTemplateManager.d.ts.map +1 -0
- package/build/domains/instruction-template/instructionTemplateManager.js +167 -0
- package/build/domains/instruction-template/instructionTemplateManager.js.map +1 -0
- package/build/domains/runtime-targets/runtimeIdentityVerification.d.ts +1 -0
- package/build/domains/runtime-targets/runtimeIdentityVerification.d.ts.map +1 -1
- package/build/domains/runtime-targets/runtimeIdentityVerification.js +6 -5
- package/build/domains/runtime-targets/runtimeIdentityVerification.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 +422 -23
- package/build/transport/http/routes/adminRoutes.js.map +1 -1
- package/build/transport/http/routes/apiRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/apiRoutes.js +2 -0
- package/build/transport/http/routes/apiRoutes.js.map +1 -1
- package/build/transport/http/routes/inspectRequestContext.d.ts +2 -0
- package/build/transport/http/routes/inspectRequestContext.d.ts.map +1 -1
- package/build/transport/http/routes/inspectRequestContext.js +15 -6
- package/build/transport/http/routes/inspectRequestContext.js.map +1 -1
- package/build/transport/http/routes/inspectRoutes.d.ts +9 -0
- package/build/transport/http/routes/inspectRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/inspectRoutes.js +15 -10
- package/build/transport/http/routes/inspectRoutes.js.map +1 -1
- package/build/transport/http/routes/instructionsRoutes.d.ts +4 -0
- package/build/transport/http/routes/instructionsRoutes.d.ts.map +1 -0
- package/build/transport/http/routes/instructionsRoutes.js +147 -0
- package/build/transport/http/routes/instructionsRoutes.js.map +1 -0
- 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 +5 -4
- 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 +17 -0
- 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/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/utils/validation/discoveredServer.d.ts +15 -0
- package/build/utils/validation/discoveredServer.d.ts.map +1 -0
- package/build/utils/validation/discoveredServer.js +2 -0
- package/build/utils/validation/discoveredServer.js.map +1 -0
- package/build/utils/validation/urlDetection.d.ts +4 -5
- package/build/utils/validation/urlDetection.d.ts.map +1 -1
- package/build/utils/validation/urlDetection.js +94 -25
- package/build/utils/validation/urlDetection.js.map +1 -1
- package/package.json +2 -2
- package/build/admin/assets/admin-console-BOl7XR0p.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
|
@@ -166,4 +166,49 @@ No MCP servers are currently connected. 1MCP is ready to connect to servers and
|
|
|
166
166
|
|
|
167
167
|
1MCP will automatically detect and connect to available MCP servers. Once connected, their tools and capabilities will become available through the unified interface.
|
|
168
168
|
{{/if}}`;
|
|
169
|
+
/** Built-in direct CLI variant matching the established `1mcp instructions` layout. */
|
|
170
|
+
export const DEFAULT_CLI_INSTRUCTION_TEMPLATE = `1MCP CLI Instructions
|
|
171
|
+
|
|
172
|
+
=== PLAYBOOK ===
|
|
173
|
+
|
|
174
|
+
1. Start here before selecting tools.
|
|
175
|
+
2. Review the available servers below and choose the server that matches the task.
|
|
176
|
+
3. Run \`1mcp inspect <server>\` to list that server's tools.
|
|
177
|
+
4. Run \`1mcp inspect <server>/<tool>\` to inspect the tool schema and arguments.
|
|
178
|
+
5. Run \`1mcp wait <server>\` when a configured static server is still loading.
|
|
179
|
+
6. Run \`1mcp run <server>/<tool> --args '<json>'\` only after inspecting the tool.
|
|
180
|
+
7. Use \`--preset\`, \`--tags\`, or \`--tag-filter\` to narrow the server set when needed.
|
|
181
|
+
8. If authentication is required, run \`1mcp auth login --context <name> --token <token>\` and retry.
|
|
182
|
+
|
|
183
|
+
=== SERVER SUMMARY ===
|
|
184
|
+
{{#each servers}}
|
|
185
|
+
|
|
186
|
+
<server_summary name="{{name}}">
|
|
187
|
+
server: {{name}}
|
|
188
|
+
{{#if summary.type}} type: {{summary.type}}
|
|
189
|
+
{{/if}}{{#if summary.status}} status: {{summary.status}}
|
|
190
|
+
{{/if}}{{#if summary.availableKnown}} available: {{#if summary.available}}yes{{else}}no{{/if}}
|
|
191
|
+
{{/if}}{{#if summary.loadTrackedKnown}} load_tracked: {{#if summary.loadTracked}}yes{{else}}no{{/if}}
|
|
192
|
+
{{/if}} tools: {{summary.toolCount}}
|
|
193
|
+
instructions: {{#if summary.hasInstructions}}yes{{else}}no{{/if}}
|
|
194
|
+
</server_summary>
|
|
195
|
+
{{/each}}
|
|
196
|
+
|
|
197
|
+
=== SERVER DETAILS ===
|
|
198
|
+
{{#each servers}}
|
|
199
|
+
|
|
200
|
+
<server_detail name="{{name}}">
|
|
201
|
+
server: {{name}}
|
|
202
|
+
{{#if type}} type: {{type}}
|
|
203
|
+
{{/if}}{{#if status}} status: {{status}}
|
|
204
|
+
{{/if}}{{#if availableKnown}} available: {{#if available}}yes{{else}}no{{/if}}
|
|
205
|
+
{{/if}}{{#if loadTrackedKnown}} load_tracked: {{#if loadTracked}}yes{{else}}no{{/if}}
|
|
206
|
+
{{/if}} tools: {{toolCount}}
|
|
207
|
+
instructions: {{#if hasInstructions}}yes{{else}}no{{/if}}
|
|
208
|
+
{{#if hasInstructions}} <server_instructions name="{{name}}">
|
|
209
|
+
{{instructions}}
|
|
210
|
+
</server_instructions>
|
|
211
|
+
{{else}} <note>{{#if note}}{{note}}{{else}}(none provided){{/if}}</note>
|
|
212
|
+
{{/if}}</server_detail>{{#unless @last}}
|
|
213
|
+
{{/unless}}{{/each~}}`;
|
|
169
214
|
//# sourceMappingURL=templateTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templateTypes.js","sourceRoot":"","sources":["../../../src/core/instructions/templateTypes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templateTypes.js","sourceRoot":"","sources":["../../../src/core/instructions/templateTypes.ts"],"names":[],"mappings":"AAsLA;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAsB;IAC1D;QACE,IAAI,EAAE,2BAA2B;QACjC,WAAW,EAAE,sCAAsC;KACpD;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,mCAAmC;KACjD;IACD;QACE,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE,yCAAyC;KACvD;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAqD;IACvF,KAAK,EAAE,qCAAqC;IAC5C,WAAW,EAAE,sBAAsB;IACnC,QAAQ,EAAE,yBAAyB;IACnC,iBAAiB,EAAE,IAAI,GAAG,IAAI,EAAE,cAAc;CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAyIpC,CAAC;AAET,uFAAuF;AACvF,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA2C1B,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,MAAM,CAAC,SAAS,EAAE,CAAC;gBACnF,MAAM,CAAC,IAAI,CAAC,8DAA8D,IAAI,EAAE,CAAC,CAAC;gBAClF,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,WA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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,MAAM,UAAU,sBAAsB,CAAC,aAAkC,EAAE,WAA8B;IACvG,MAAM,SAAS,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,+BAA+B,CAAC,aAAa,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AG,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"}
|
|
@@ -4,8 +4,12 @@ import { InboundConnection, OutboundConnection, OutboundConnections } from '../.
|
|
|
4
4
|
import type { MCPServerParams } from '../../core/types/transport.js';
|
|
5
5
|
export declare function getRequestSession(inboundConn: InboundConnection): string | undefined;
|
|
6
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;
|
|
7
9
|
export declare function resolveOutboundConnection(clientName: string, sessionId: string | undefined, outboundConns: OutboundConnections, inboundConn?: InboundConnection): OutboundConnection | undefined;
|
|
8
10
|
export declare function filterConnectionsForSession(outboundConns: OutboundConnections, sessionId: string | undefined): OutboundConnections;
|
|
9
11
|
/** Resolve request-time Filter Selection into a Server Candidate Set. */
|
|
10
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;
|
|
11
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;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,
|
|
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,O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+1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getConfiguredServerTargets } from '../../config/configuredServerTargets.js';
|
|
2
2
|
import { CapabilityCatalog } from '../../core/capabilities/capabilityCatalog.js';
|
|
3
3
|
import { createCapabilityVisibility } from '../../core/capabilities/capabilityVisibility.js';
|
|
4
4
|
import { SchemaCache } from '../../core/capabilities/schemaCache.js';
|
|
@@ -13,7 +13,7 @@ import { getRequestTimeout } from '../../utils/core/timeoutUtils.js';
|
|
|
13
13
|
export function getRequestSession(inboundConn) {
|
|
14
14
|
return inboundConn.context?.sessionId;
|
|
15
15
|
}
|
|
16
|
-
export async function createCapabilityCatalogFromConnections(connections, getServerConfigs =
|
|
16
|
+
export async function createCapabilityCatalogFromConnections(connections, getServerConfigs = getConfiguredServerTargets) {
|
|
17
17
|
const toolsByServer = new Map();
|
|
18
18
|
const tagsByServer = new Map();
|
|
19
19
|
await Promise.all(Array.from(connections.entries()).map(async ([connectionKey, connection]) => {
|
|
@@ -41,6 +41,15 @@ export async function createCapabilityCatalogFromConnections(connections, getSer
|
|
|
41
41
|
templateHashProvider: ServerManager.current.getTemplateServerManager(),
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
+
/** Create the runtime Capability Catalog used by protocol capability walks. */
|
|
45
|
+
export function createProtocolCapabilityCatalog(connections, getServerConfigs = getConfiguredServerTargets) {
|
|
46
|
+
return new CapabilityCatalog({
|
|
47
|
+
getToolRegistry: ToolRegistry.empty,
|
|
48
|
+
schemaCache: new SchemaCache({ maxEntries: 100 }),
|
|
49
|
+
outboundConnections: connections,
|
|
50
|
+
getServerConfigs,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
44
53
|
export function resolveOutboundConnection(clientName, sessionId, outboundConns, inboundConn) {
|
|
45
54
|
const scopedConns = filterConnectionsForSession(outboundConns, sessionId);
|
|
46
55
|
const filteredConns = inboundConn ? FilteringService.getFilteredConnections(scopedConns, inboundConn) : scopedConns;
|
|
@@ -55,10 +64,21 @@ export function filterConnectionsForSession(outboundConns, sessionId) {
|
|
|
55
64
|
}
|
|
56
65
|
/** Resolve request-time Filter Selection into a Server Candidate Set. */
|
|
57
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) {
|
|
58
71
|
// Scope template instances before applying client filters and availability.
|
|
59
72
|
const sessionScoped = filterConnectionsForSession(outboundConns, sessionId);
|
|
60
73
|
const tagAndPresetScoped = FilteringService.getFilteredConnections(sessionScoped, inboundConn);
|
|
61
|
-
const
|
|
62
|
-
|
|
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
|
+
});
|
|
63
83
|
}
|
|
64
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,
|
|
1
|
+
{"version":3,"file":"requestHandlerUtils.js","sourceRoot":"","sources":["../../../src/core/protocol/requestHandlerUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,M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AAa,GAAG,2BAA2B,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IAC5E,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,sBAAsB,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IAC/F,MAAM,qBAAqB,GACzB,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,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":3,"file":"resourceRequestHandlers.js","sourceRoot":"","sources":["../../../src/core/protocol/resourceRequestHandlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,EAE1B,kCAAkC,EAClC,yBAAyB,EAGzB,sBAAsB,EACtB,wBAAwB,GACzB,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,MAAM,UAAU,wBAAwB,CAAC,aAAkC,EAAE,WAA8B;IACzG,MAAM,SAAS,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACjD,MAAM,OAAO,GAAG,+BAA+B,CAAC,aAAa,CAAC,CAAC;IAE/D,WAAW,CAAC,MAAM,CAAC,iBAAiB,CAClC,0BAA0B,EAC1B,iBAAiB,CAAC,KAAK,EAAE,OAA6B,EAAE,EAAE;QACxD,MAAM,UAAU,GAAG,2BAA2B,CAAC,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,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,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,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,YAAY,CACrD,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,EACxC;YACE,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,SAAS,CAAC;SACnD,CACF,CAAC;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":"AAeA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAI5F,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,CAmLN"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { CallToolRequestSchema, CallToolResultSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { getConfiguredServerTargets } from '../../config/configuredServerTargets.js';
|
|
3
3
|
import { MCP_URI_SEPARATOR } from '../../constants.js';
|
|
4
|
+
import { publishCompleteConfiguredToolTargetSnapshots, publishConfiguredToolPage, } from '../../core/capabilities/configuredToolSnapshot.js';
|
|
4
5
|
import { InternalCapabilitiesProvider } from '../../core/capabilities/internalCapabilitiesProvider.js';
|
|
5
|
-
import {
|
|
6
|
-
import { FilteringService } from '../../core/filtering/filteringService.js';
|
|
6
|
+
import { executeWithPostAuthOAuthRecovery } from '../../core/client/postAuthOAuthRecovery.js';
|
|
7
7
|
import { getDisabledToolError } from '../../core/server/disabledTools.js';
|
|
8
|
+
import { applyEffectiveToolDescription } from '../../core/server/toolDescriptionOverrides.js';
|
|
8
9
|
import logger, { infoIf } from '../../logger/logger.js';
|
|
9
10
|
import { withErrorHandling } from '../../utils/core/errorHandling.js';
|
|
10
11
|
import { buildUri, parseUri } from '../../utils/core/parsing.js';
|
|
11
12
|
import { getRequestTimeout } from '../../utils/core/timeoutUtils.js';
|
|
12
|
-
import {
|
|
13
|
+
import { createProtocolCapabilityCatalog, getRequestSession, resolveCapabilityVisibility, resolveLazyCapabilityVisibility, resolveOutboundConnection, } from './requestHandlerUtils.js';
|
|
13
14
|
export function registerToolHandlers(outboundConns, inboundConn, lazyLoadingOrchestrator) {
|
|
14
15
|
const sessionId = getRequestSession(inboundConn);
|
|
15
16
|
const lazyLoadingEnabled = lazyLoadingOrchestrator?.isEnabled();
|
|
16
|
-
const getServerConfigs = () =>
|
|
17
|
+
const getServerConfigs = () => getConfiguredServerTargets();
|
|
18
|
+
const catalog = createProtocolCapabilityCatalog(outboundConns, getServerConfigs);
|
|
17
19
|
inboundConn.server.setRequestHandler(ListToolsRequestSchema, withErrorHandling(async (request) => {
|
|
18
20
|
if (lazyLoadingEnabled && lazyLoadingOrchestrator) {
|
|
19
21
|
const visibility = resolveLazyCapabilityVisibility(outboundConns, inboundConn, sessionId);
|
|
@@ -37,34 +39,74 @@ export function registerToolHandlers(outboundConns, inboundConn, lazyLoadingOrch
|
|
|
37
39
|
const internalTools = internalProvider.getAvailableTools();
|
|
38
40
|
const lazyToolNames = ['tool_list', 'tool_schema', 'tool_invoke'];
|
|
39
41
|
const nonLazyTools = internalTools.filter((tool) => !lazyToolNames.includes(tool.name));
|
|
42
|
+
const paginationFacts = createToolPaginationFacts(internalTools, getServerConfigs());
|
|
40
43
|
const internalToolsWithPrefix = nonLazyTools.map((tool) => ({
|
|
41
44
|
...tool,
|
|
42
45
|
name: buildUri('1mcp', tool.name, MCP_URI_SEPARATOR),
|
|
43
46
|
}));
|
|
47
|
+
const tools = [...capabilities.tools, ...internalToolsWithPrefix].sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
48
|
+
const result = await catalog.listVisibleCapabilityPages({
|
|
49
|
+
kind: 'tools',
|
|
50
|
+
visibility,
|
|
51
|
+
cursor: request.params?.cursor,
|
|
52
|
+
list: async () => ({ items: [] }),
|
|
53
|
+
internalPages: [{ id: '\0app.1mcp/lazy-tools', name: '1mcp', items: tools }],
|
|
54
|
+
includeExternal: false,
|
|
55
|
+
filterSelection: { lazy: true, ...paginationFacts },
|
|
56
|
+
generationSignature: paginationFacts,
|
|
57
|
+
enablePagination: inboundConn.enablePagination ?? false,
|
|
58
|
+
});
|
|
44
59
|
return {
|
|
45
|
-
tools:
|
|
60
|
+
tools: result.items,
|
|
61
|
+
nextCursor: result.nextCursor,
|
|
62
|
+
_meta: result._meta,
|
|
46
63
|
};
|
|
47
64
|
}
|
|
48
|
-
const
|
|
49
|
-
const capabilityFilteredClients = byCapabilities({ tools: {} })(sessionFilteredConns);
|
|
50
|
-
const filteredClients = FilteringService.getFilteredConnections(capabilityFilteredClients, inboundConn);
|
|
51
|
-
const catalog = await createCapabilityCatalogFromConnections(filteredClients, getServerConfigs);
|
|
52
|
-
const result = await catalog.listVisibleTools(request.params || {});
|
|
65
|
+
const visibility = resolveCapabilityVisibility(outboundConns, inboundConn, sessionId, 'tools');
|
|
53
66
|
const internalProvider = InternalCapabilitiesProvider.getInstance();
|
|
54
67
|
await internalProvider.initialize();
|
|
55
68
|
const internalTools = internalProvider.getAvailableTools();
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
const serverConfigs = getServerConfigs();
|
|
70
|
+
const paginationFacts = createToolPaginationFacts(internalTools, serverConfigs);
|
|
71
|
+
const result = await catalog.listVisibleCapabilityPages({
|
|
72
|
+
kind: 'tools',
|
|
73
|
+
visibility,
|
|
74
|
+
cursor: request.params?.cursor,
|
|
75
|
+
list: async (outboundConn, cursor) => {
|
|
76
|
+
const upstream = await outboundConn.client.listTools({ cursor }, { timeout: getRequestTimeout(outboundConn.transport) });
|
|
77
|
+
publishConfiguredToolPage(outboundConn, upstream.tools ?? [], cursor, upstream.nextCursor);
|
|
78
|
+
if (upstream.nextCursor === undefined) {
|
|
79
|
+
publishCompleteConfiguredToolTargetSnapshots(outboundConns);
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
items: upstream.tools ?? [],
|
|
83
|
+
nextCursor: upstream.nextCursor,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
mapItem: (tool, serverName) => ({
|
|
87
|
+
...applyEffectiveToolDescription(tool, serverConfigs[serverName], serverName),
|
|
88
|
+
name: buildUri(serverName, tool.name, MCP_URI_SEPARATOR),
|
|
89
|
+
inputSchema: tool.inputSchema ?? { type: 'object' },
|
|
90
|
+
}),
|
|
91
|
+
internalPages: [
|
|
92
|
+
{
|
|
93
|
+
id: '\0app.1mcp/internal-tools',
|
|
94
|
+
name: '1mcp',
|
|
95
|
+
items: internalTools.map((tool) => ({
|
|
96
|
+
...tool,
|
|
97
|
+
name: buildUri('1mcp', tool.name, MCP_URI_SEPARATOR),
|
|
98
|
+
})),
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
filterSelection: paginationFacts,
|
|
102
|
+
generationSignature: paginationFacts,
|
|
103
|
+
serverConfigs,
|
|
104
|
+
enablePagination: inboundConn.enablePagination ?? false,
|
|
105
|
+
});
|
|
65
106
|
return {
|
|
66
|
-
tools:
|
|
107
|
+
tools: result.items,
|
|
67
108
|
nextCursor: result.nextCursor,
|
|
109
|
+
_meta: result._meta,
|
|
68
110
|
};
|
|
69
111
|
}, 'Error listing tools'));
|
|
70
112
|
inboundConn.server.setRequestHandler(CallToolRequestSchema, withErrorHandling(async (request) => {
|
|
@@ -113,11 +155,25 @@ export function registerToolHandlers(outboundConns, inboundConn, lazyLoadingOrch
|
|
|
113
155
|
},
|
|
114
156
|
});
|
|
115
157
|
}
|
|
116
|
-
return outboundConn.client.callTool({ ...request.params, name: extractedToolName }, CallToolResultSchema, {
|
|
158
|
+
return executeWithPostAuthOAuthRecovery(clientName, outboundConn, () => outboundConn.client.callTool({ ...request.params, name: extractedToolName }, CallToolResultSchema, {
|
|
117
159
|
timeout: getRequestTimeout(outboundConn.transport),
|
|
118
|
-
});
|
|
160
|
+
}));
|
|
119
161
|
}, 'Error calling tool'));
|
|
120
162
|
}
|
|
163
|
+
function createToolPaginationFacts(internalTools, serverConfigs) {
|
|
164
|
+
return {
|
|
165
|
+
disabledTools: Object.fromEntries(Object.entries(serverConfigs)
|
|
166
|
+
.filter(([, config]) => config.disabledTools?.length)
|
|
167
|
+
.map(([name, config]) => [name, [...(config.disabledTools ?? [])].sort()])),
|
|
168
|
+
toolDescriptionOverrides: Object.fromEntries(Object.entries(serverConfigs)
|
|
169
|
+
.filter(([, config]) => Object.keys(config.toolDescriptionOverrides ?? {}).length > 0)
|
|
170
|
+
.map(([name, config]) => [
|
|
171
|
+
name,
|
|
172
|
+
Object.fromEntries(Object.entries(config.toolDescriptionOverrides ?? {}).sort(([left], [right]) => left.localeCompare(right))),
|
|
173
|
+
])),
|
|
174
|
+
internalTools: internalTools.map((tool) => tool.name).sort(),
|
|
175
|
+
};
|
|
176
|
+
}
|
|
121
177
|
function structuredToolResult(result) {
|
|
122
178
|
return {
|
|
123
179
|
content: [
|