const require_chunk = require('./chunk-DWy1uDak.cjs');
const require_define = require('./define-BfP4rFlE.cjs');
const require_api = require('./api-CZD9zwQ-.cjs');
const require_schema = require('./schema-Cv_VNAHz.cjs');
const __sentry_core = require_chunk.__toESM(require("@sentry/core"));

//#region src/tools/find-dsns.ts
var find_dsns_default = require_define.defineTool({
	name: "find_dsns",
	requiredScopes: ["project:read"],
	description: [
		"List all Sentry DSNs for a specific project.",
		"",
		"Use this tool when you need to:",
		"- Retrieve a SENTRY_DSN for a specific project",
		"",
		"<hints>",
		"- If the user passes a parameter in the form of name/otherName, its likely in the format of <organizationSlug>/<projectSlug>.",
		"- If only one parameter is provided, and it could be either `organizationSlug` or `projectSlug`, its probably `organizationSlug`, but if you're really uncertain you might want to call `find_organizations()` first.",
		"</hints>"
	].join("\n"),
	inputSchema: {
		organizationSlug: require_schema.ParamOrganizationSlug,
		regionUrl: require_schema.ParamRegionUrl.optional(),
		projectSlug: require_schema.ParamProjectSlug
	},
	annotations: {
		readOnlyHint: true,
		openWorldHint: true
	},
	async handler(params, context) {
		const apiService = require_api.apiServiceFromContext(context, { regionUrl: params.regionUrl });
		const organizationSlug = params.organizationSlug;
		(0, __sentry_core.setTag)("organization.slug", organizationSlug);
		(0, __sentry_core.setTag)("project.slug", params.projectSlug);
		const clientKeys = await apiService.listClientKeys({
			organizationSlug,
			projectSlug: params.projectSlug
		});
		let output = `# DSNs in **${organizationSlug}/${params.projectSlug}**\n\n`;
		if (clientKeys.length === 0) {
			output += "No DSNs were found.\n\nYou can create new one using the `create_dsn` tool.";
			return output;
		}
		for (const clientKey of clientKeys) {
			output += `## ${clientKey.name}\n`;
			output += `**ID**: ${clientKey.id}\n`;
			output += `**DSN**: ${clientKey.dsn.public}\n\n`;
		}
		output += "# Using this information\n\n";
		output += "- The `SENTRY_DSN` value is a URL that you can use to initialize Sentry's SDKs.\n";
		return output;
	}
});

//#endregion
Object.defineProperty(exports, 'find_dsns_default', {
  enumerable: true,
  get: function () {
    return find_dsns_default;
  }
});
//# sourceMappingURL=find-dsns-Ct6uFZMB.cjs.map