@gohcltech/bitbucket-mcp
Version:
Bitbucket integration for Claude via Model Context Protocol
406 lines • 12.8 kB
TypeScript
/**
* @fileoverview Zod validation schemas for Bitbucket issue operations.
*
* This module provides comprehensive validation schemas for issue tracking
* operations using Zod for runtime type checking and validation. These schemas
* ensure that data conforms to Bitbucket API v2.0 specifications and provide
* type-safe validation for MCP tool inputs and API responses.
*
* Key features:
* - Runtime validation of issue and comment API responses
* - Project management entity validation (components, milestones, versions)
* - User and content validation across issue contexts
* - Input parameter validation for issue management tools
* - Type-safe schema definitions matching TypeScript interfaces
* - Comprehensive error reporting for validation failures
*/
import { z } from 'zod';
/**
* Zod schema for validating issue state values.
* Ensures only valid lifecycle states are used for issues.
*/
export declare const IssueStateSchema: z.ZodEnum<["new", "open", "resolved", "on hold", "invalid", "duplicate", "wontfix", "closed"]>;
/**
* Zod schema for validating issue kind/category values.
* Ensures only valid issue types are used for classification.
*/
export declare const IssueKindSchema: z.ZodEnum<["bug", "enhancement", "proposal", "task"]>;
/**
* Zod schema for validating issue priority values.
* Ensures only valid priority levels are used for issue prioritization.
*/
export declare const IssuePrioritySchema: z.ZodEnum<["trivial", "minor", "major", "critical", "blocker"]>;
/**
* Zod schema for validating formatted content entities.
* Used for issue descriptions, comments, and other rich text content.
*/
export declare const ContentSchema: z.ZodObject<{
/**
* Raw content as entered by the user.
* Must be non-empty and within reasonable length limits.
*/
raw: z.ZodString;
/**
* Markup language used for the content.
* Defaults to markdown for Bitbucket content.
*/
markup: z.ZodDefault<z.ZodString>;
/**
* Optional HTML-rendered version of the content.
* Contains processed output when markup is rendered.
*/
html: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
raw: string;
markup: string;
html?: string | undefined;
}, {
raw: string;
html?: string | undefined;
markup?: string | undefined;
}>;
/**
* Zod schema for validating user entities.
* Used for assignees, reporters, and comment authors in issue contexts.
*/
export declare const UserSchema: z.ZodObject<{
/**
* Human-readable display name for the user.
* Must be a non-empty string.
*/
display_name: z.ZodString;
/**
* Unique UUID identifier for the user.
* Must be a non-empty string in UUID format.
*/
uuid: z.ZodString;
/**
* Atlassian account ID for cross-product integration.
* Must follow the Atlassian account ID format.
*/
account_id: z.ZodString;
/**
* User's chosen nickname or username.
* Must be a non-empty string.
*/
nickname: z.ZodString;
/**
* Entity type discriminator.
* Must always be "user" for user entities.
*/
type: z.ZodLiteral<"user">;
/**
* Optional collection of related URLs for the user.
*/
links: z.ZodOptional<z.ZodObject<{
/** API endpoint for this user's details */
self: z.ZodObject<{
href: z.ZodString;
}, "strip", z.ZodTypeAny, {
href: string;
}, {
href: string;
}>;
/** URL to the user's avatar image */
avatar: z.ZodObject<{
href: z.ZodString;
}, "strip", z.ZodTypeAny, {
href: string;
}, {
href: string;
}>;
/** URL to the user's profile page */
html: z.ZodObject<{
href: z.ZodString;
}, "strip", z.ZodTypeAny, {
href: string;
}, {
href: string;
}>;
}, "strip", z.ZodTypeAny, {
html: {
href: string;
};
avatar: {
href: string;
};
self: {
href: string;
};
}, {
html: {
href: string;
};
avatar: {
href: string;
};
self: {
href: string;
};
}>>;
}, "strip", z.ZodTypeAny, {
type: "user";
uuid: string;
display_name: string;
account_id: string;
nickname: string;
links?: {
html: {
href: string;
};
avatar: {
href: string;
};
self: {
href: string;
};
} | undefined;
}, {
type: "user";
uuid: string;
display_name: string;
account_id: string;
nickname: string;
links?: {
html: {
href: string;
};
avatar: {
href: string;
};
self: {
href: string;
};
} | undefined;
}>;
/**
* Input validation schema for issue-related MCP tool parameters.
*
* This schema validates the basic parameters required by issue tools,
* extending the repository base schema with issue-specific validation.
* Used by tools that operate on existing issues.
*
* @example
* ```typescript
* const input = {
* workspace: 'gohcl',
* repo_slug: 'bitbucket-mcp',
* issue_id: 42
* };
* const validatedInput = IssueInputSchema.parse(input);
* ```
*/
export declare const IssueInputSchema: z.ZodObject<{
workspace: z.ZodString;
} & {
repo_slug: z.ZodString;
} & {
/**
* Numeric identifier for the target issue.
* Must be a positive integer referencing an existing issue.
*/
issue_id: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
workspace: string;
repo_slug: string;
issue_id: number;
}, {
workspace: string;
repo_slug: string;
issue_id: number;
}>;
/**
* Input validation schema for the create_issue MCP tool.
*
* This schema validates parameters for creating new issues, including
* required fields like title and optional metadata for categorization,
* assignment, and project management.
*
* @example
* ```typescript
* const input = {
* workspace: 'gohcl',
* repo_slug: 'bitbucket-mcp',
* title: 'Add OAuth 2.0 authentication support',
* content: 'We need to implement OAuth 2.0 for secure authentication...',
* kind: 'enhancement',
* priority: 'major',
* component: 'Authentication',
* assignee: 'kurtwolf'
* };
* const validatedInput = CreateIssueInputSchema.parse(input);
* ```
*/
export declare const CreateIssueInputSchema: z.ZodObject<{
workspace: z.ZodString;
} & {
repo_slug: z.ZodString;
} & {
/**
* Issue title summarizing the problem or request.
* Must be descriptive and within character limits.
*/
title: z.ZodString;
/**
* Optional detailed description of the issue.
* Can contain markdown formatting and comprehensive details.
*/
content: z.ZodOptional<z.ZodString>;
/**
* Issue category or type (defaults to 'task').
* Helps classify the nature of the work being tracked.
*/
kind: z.ZodDefault<z.ZodEnum<["bug", "enhancement", "proposal", "task"]>>;
/**
* Issue priority level (defaults to 'minor').
* Indicates urgency and importance for prioritization.
*/
priority: z.ZodDefault<z.ZodEnum<["trivial", "minor", "major", "critical", "blocker"]>>;
/**
* Optional component name for functional categorization.
* Should match an existing component in the repository.
*/
component: z.ZodOptional<z.ZodString>;
/**
* Optional milestone name for project planning.
* Should match an existing milestone in the repository.
*/
milestone: z.ZodOptional<z.ZodString>;
/**
* Optional version name for release tracking.
* Should match an existing version in the repository.
*/
version: z.ZodOptional<z.ZodString>;
/**
* Optional username to assign the issue to.
* Should be a valid Bitbucket username with repository access.
*/
assignee: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
workspace: string;
priority: "trivial" | "minor" | "major" | "critical" | "blocker";
repo_slug: string;
kind: "bug" | "enhancement" | "proposal" | "task";
title: string;
version?: string | undefined;
content?: string | undefined;
component?: string | undefined;
milestone?: string | undefined;
assignee?: string | undefined;
}, {
workspace: string;
repo_slug: string;
title: string;
version?: string | undefined;
priority?: "trivial" | "minor" | "major" | "critical" | "blocker" | undefined;
kind?: "bug" | "enhancement" | "proposal" | "task" | undefined;
content?: string | undefined;
component?: string | undefined;
milestone?: string | undefined;
assignee?: string | undefined;
}>;
/**
* Input validation schema for the list_issues MCP tool.
*
* This schema validates parameters for listing issues with comprehensive
* filtering and sorting options. Supports filtering by state, category,
* priority, assignment, and project management metadata.
*
* @example
* ```typescript
* const input = {
* workspace: 'gohcl',
* repo_slug: 'bitbucket-mcp',
* state: 'open',
* kind: 'bug',
* priority: 'major',
* assignee: 'kurtwolf',
* sort: 'priority',
* limit: 25
* };
* const validatedInput = ListIssuesInputSchema.parse(input);
* ```
*/
export declare const ListIssuesInputSchema: z.ZodObject<{
workspace: z.ZodString;
} & {
repo_slug: z.ZodString;
} & {
/**
* Optional state filter for issues.
* When specified, only returns issues in the given state.
*/
state: z.ZodOptional<z.ZodEnum<["new", "open", "resolved", "on hold", "invalid", "duplicate", "wontfix", "closed"]>>;
/**
* Optional kind/category filter for issues.
* When specified, only returns issues of the given type.
*/
kind: z.ZodOptional<z.ZodEnum<["bug", "enhancement", "proposal", "task"]>>;
/**
* Optional priority filter for issues.
* When specified, only returns issues with the given priority.
*/
priority: z.ZodOptional<z.ZodEnum<["trivial", "minor", "major", "critical", "blocker"]>>;
/**
* Optional component filter for issues.
* When specified, only returns issues assigned to the given component.
*/
component: z.ZodOptional<z.ZodString>;
/**
* Optional milestone filter for issues.
* When specified, only returns issues assigned to the given milestone.
*/
milestone: z.ZodOptional<z.ZodString>;
/**
* Optional version filter for issues.
* When specified, only returns issues assigned to the given version.
*/
version: z.ZodOptional<z.ZodString>;
/**
* Optional assignee filter for issues.
* When specified, only returns issues assigned to the given user.
*/
assignee: z.ZodOptional<z.ZodString>;
/**
* Optional reporter filter for issues.
* When specified, only returns issues reported by the given user.
*/
reporter: z.ZodOptional<z.ZodString>;
/**
* Optional sort order for the results.
* Determines how the returned issues are ordered.
*/
sort: z.ZodOptional<z.ZodEnum<["created_on", "updated_on", "priority", "votes"]>>;
/**
* Maximum number of issues to return (default: 50).
* Must be between 1 and 100 to prevent excessive response sizes.
*/
limit: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
workspace: string;
repo_slug: string;
limit: number;
sort?: "priority" | "created_on" | "updated_on" | "votes" | undefined;
version?: string | undefined;
priority?: "trivial" | "minor" | "major" | "critical" | "blocker" | undefined;
kind?: "bug" | "enhancement" | "proposal" | "task" | undefined;
state?: "new" | "open" | "resolved" | "on hold" | "invalid" | "duplicate" | "wontfix" | "closed" | undefined;
component?: string | undefined;
milestone?: string | undefined;
assignee?: string | undefined;
reporter?: string | undefined;
}, {
workspace: string;
repo_slug: string;
sort?: "priority" | "created_on" | "updated_on" | "votes" | undefined;
version?: string | undefined;
priority?: "trivial" | "minor" | "major" | "critical" | "blocker" | undefined;
kind?: "bug" | "enhancement" | "proposal" | "task" | undefined;
state?: "new" | "open" | "resolved" | "on hold" | "invalid" | "duplicate" | "wontfix" | "closed" | undefined;
component?: string | undefined;
milestone?: string | undefined;
assignee?: string | undefined;
reporter?: string | undefined;
limit?: number | undefined;
}>;
//# sourceMappingURL=schemas.d.ts.map