MCPcopy Index your code
hub / github.com/simstudioai/sim / getServerSummaries

Method getServerSummaries

apps/sim/lib/mcp/service.ts:716–781  ·  view source on GitHub ↗
(userId: string, workspaceId: string)

Source from the content-addressed store, hash-verified

714 }
715
716 async getServerSummaries(userId: string, workspaceId: string): Promise<McpServerSummary[]> {
717 const requestId = generateRequestId()
718
719 try {
720 logger.info(`[${requestId}] Getting server summaries for workspace ${workspaceId}`)
721
722 const servers = await this.getWorkspaceServers(workspaceId)
723 const summaries: McpServerSummary[] = []
724
725 for (const config of servers) {
726 try {
727 const { config: resolvedConfig, resolvedIP } = await this.resolveConfigEnvVars(
728 config,
729 userId,
730 workspaceId
731 )
732 const client = await this.createClient(resolvedConfig, resolvedIP, userId)
733 const tools = await client.listTools()
734 await client.disconnect()
735
736 summaries.push({
737 id: config.id,
738 name: config.name,
739 url: config.url,
740 transport: config.transport,
741 status: 'connected',
742 toolCount: tools.length,
743 lastSeen: new Date(),
744 error: undefined,
745 })
746 } catch (error) {
747 if (
748 error instanceof McpOauthAuthorizationRequiredError ||
749 error instanceof UnauthorizedError
750 ) {
751 summaries.push({
752 id: config.id,
753 name: config.name,
754 url: config.url,
755 transport: config.transport,
756 status: 'disconnected',
757 toolCount: 0,
758 lastSeen: undefined,
759 error: undefined,
760 })
761 continue
762 }
763 summaries.push({
764 id: config.id,
765 name: config.name,
766 url: config.url,
767 transport: config.transport,
768 status: 'error',
769 toolCount: 0,
770 lastSeen: undefined,
771 error: getErrorMessage(error, 'Connection failed'),
772 })
773 }

Callers

nothing calls this directly

Calls 10

getWorkspaceServersMethod · 0.95
resolveConfigEnvVarsMethod · 0.95
createClientMethod · 0.95
generateRequestIdFunction · 0.90
getErrorMessageFunction · 0.90
infoMethod · 0.80
listToolsMethod · 0.80
errorMethod · 0.80
disconnectMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected