const require_chunk = require('./chunk-DWy1uDak.cjs');
const require_errors = require('./errors-BtJEw2Z-.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-projects.ts
const RESULT_LIMIT = 25;
var find_projects_default = require_define.defineTool({
	name: "find_projects",
	requiredScopes: ["project:read"],
	description: [
		"Find projects in Sentry.",
		"",
		"Use this tool when you need to:",
		"- View projects in a Sentry organization",
		"- Find a project's slug to aid other tool requests",
		"- Search for specific projects by name or slug",
		"",
		`Returns up to ${RESULT_LIMIT} results. If you hit this limit, use the query parameter to narrow down results.`
	].join("\n"),
	inputSchema: {
		organizationSlug: require_schema.ParamOrganizationSlug,
		regionUrl: require_schema.ParamRegionUrl.optional(),
		query: require_schema.ParamSearchQuery.optional()
	},
	annotations: {
		readOnlyHint: true,
		openWorldHint: true
	},
	async handler(params, context) {
		const apiService = require_api.apiServiceFromContext(context, { regionUrl: params.regionUrl });
		const organizationSlug = params.organizationSlug;
		if (!organizationSlug) throw new require_errors.UserInputError("Organization slug is required. Please provide an organizationSlug parameter.");
		(0, __sentry_core.setTag)("organization.slug", organizationSlug);
		const projects = await apiService.listProjects(organizationSlug, { query: params.query });
		let output = `# Projects in **${organizationSlug}**\n\n`;
		if (params.query) output += `**Search query:** "${params.query}"\n\n`;
		if (projects.length === 0) {
			output += params.query ? `No projects found matching "${params.query}".\n` : "No projects found.\n";
			return output;
		}
		output += projects.map((project) => `- **${project.slug}**\n`).join("");
		if (projects.length === RESULT_LIMIT) output += `\n---\n\n**Note:** Showing ${RESULT_LIMIT} results (maximum). There may be more projects available. Use the \`query\` parameter to search for specific projects.`;
		return output;
	}
});

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