const require_chunk = require('./chunk-DWy1uDak.cjs');
const require_define = require('./define-BfP4rFlE.cjs');
const require_logging = require('./logging-CkAJKyq2.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"));
const zod = require_chunk.__toESM(require("zod"));

//#region src/tools/create-project.ts
var create_project_default = require_define.defineTool({
	name: "create_project",
	requiredScopes: ["project:write", "team:read"],
	description: [
		"Create a new project in Sentry (includes DSN automatically).",
		"",
		"🔍 USE THIS TOOL WHEN USERS WANT TO:",
		"- 'Create a new project'",
		"- 'Set up a project for [app/service] with team [X]'",
		"- 'I need a new Sentry project'",
		"- Create project AND need DSN in one step",
		"",
		"❌ DO NOT USE create_dsn after this - DSN is included in output.",
		"",
		"Be careful when using this tool!",
		"",
		"<examples>",
		"### Create new project with team",
		"```",
		"create_project(organizationSlug='my-organization', teamSlug='my-team', name='my-project', platform='javascript')",
		"```",
		"</examples>",
		"",
		"<hints>",
		"- If the user passes a parameter in the form of name/otherName, its likely in the format of <organizationSlug>/<teamSlug>.",
		"- If any parameter is ambiguous, you should clarify with the user what they meant.",
		"</hints>"
	].join("\n"),
	inputSchema: {
		organizationSlug: require_schema.ParamOrganizationSlug,
		regionUrl: require_schema.ParamRegionUrl.optional(),
		teamSlug: require_schema.ParamTeamSlug,
		name: zod.z.string().trim().describe("The name of the project to create. Typically this is commonly the name of the repository or service. It is only used as a visual label in Sentry."),
		platform: require_schema.ParamPlatform.optional()
	},
	annotations: {
		readOnlyHint: false,
		destructiveHint: false,
		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)("team.slug", params.teamSlug);
		const project = await apiService.createProject({
			organizationSlug,
			teamSlug: params.teamSlug,
			name: params.name,
			platform: params.platform
		});
		let clientKey = null;
		try {
			clientKey = await apiService.createClientKey({
				organizationSlug,
				projectSlug: project.slug,
				name: "Default"
			});
		} catch (err) {
			require_logging.logIssue(err);
		}
		let output = `# New Project in **${organizationSlug}**\n\n`;
		output += `**ID**: ${project.id}\n`;
		output += `**Slug**: ${project.slug}\n`;
		output += `**Name**: ${project.name}\n`;
		if (clientKey) output += `**SENTRY_DSN**: ${clientKey?.dsn.public}\n\n`;
		else output += "**SENTRY_DSN**: There was an error fetching this value.\n\n";
		output += "# Using this information\n\n";
		output += `- You can reference the **SENTRY_DSN** value to initialize Sentry's SDKs.\n`;
		output += `- You should always inform the user of the **SENTRY_DSN** and Project Slug values.\n`;
		return output;
	}
});

//#endregion
Object.defineProperty(exports, 'create_project_default', {
  enumerable: true,
  get: function () {
    return create_project_default;
  }
});
//# sourceMappingURL=create-project-CZBklXm8.cjs.map