All files / src types.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 0/0
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48  1x             1x                                                                              
// Transport mode constants and type
const TransportModeObj = {
  STDIO: "stdio",
  SSE: "sse",
  STREAMABLE_HTTP: "streamable-http",
  DUAL: "dual",
} as const;
 
export { TransportModeObj as TransportMode };
export type TransportMode = (typeof TransportModeObj)[keyof typeof TransportModeObj];
 
// Common GitLab API response types
export interface GitLabAPIResponse<T = unknown> {
  data: T;
  status: number;
  statusText: string;
}
 
// Tool definition interface
export interface ToolDefinition {
  name: string;
  description: string;
  inputSchema: Record<string, unknown>;
}
 
// Feature gate metadata for USE_* environment variables
export interface FeatureGate {
  envVar: string; // e.g., "USE_LABELS"
  defaultValue: boolean; // Default when env var is not set
}
 
// Enhanced tool definition interface that includes handler function
export interface EnhancedToolDefinition extends ToolDefinition {
  handler: (args: unknown) => Promise<unknown>;
  gate?: FeatureGate; // Optional - tools without gate are always enabled
  /**
   * Mark the tool as idempotent (safe to retry on failure).
   * If not specified, idempotency is inferred from tool name:
   * - browse_*, list_*, get_*, download_* are considered idempotent (read-only)
   * - manage_* are considered non-idempotent (write operations)
   * Set explicitly to override the default behavior.
   */
  idempotent?: boolean;
}
 
// Tool registry type for storing enhanced tool definitions
export type ToolRegistry = Map<string, EnhancedToolDefinition>;