Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/sentry-mcp

src/list-organizations.ts

22 lines · 486 B · TypeScript
import { sentryMcpSetupMessage, callSentryMcp, firstArray } from './mcp.ts'

type Input = { limit?: number }

export default async function listOrganizations(input: Input = {}) {
	const mcp = await callSentryMcp(
		[
  "list_organizations",
  "listOrganizations",
  "find_organizations"
],
		{ limit: input.limit ?? 10 },
	)
	if (!mcp) {
		throw new Error(sentryMcpSetupMessage())
	}
	return {
		via: 'mcp',
		tool: mcp.tool,
		organizations: firstArray(mcp.result) ?? mcp.result,
	}
}