pub struct GitLabMcpHandler { /* private fields */ }Expand description
GitLab MCP server handler
Implementations§
Source§impl GitLabMcpHandler
impl GitLabMcpHandler
Sourcepub fn new(
config: &AppConfig,
gitlab: GitLabClient,
access: AccessResolver,
) -> Self
pub fn new( config: &AppConfig, gitlab: GitLabClient, access: AccessResolver, ) -> Self
Create a new handler from configuration
Create a new handler with shared (Arc-wrapped) resources
This is useful when creating multiple handlers that share the same GitLab client and access resolver (e.g., for HTTP transport with multiple concurrent connections).
Sourcepub fn new_with_metrics(
config: &AppConfig,
gitlab: Arc<GitLabClient>,
access: Arc<AccessResolver>,
metrics: Arc<DashboardMetrics>,
) -> Self
pub fn new_with_metrics( config: &AppConfig, gitlab: Arc<GitLabClient>, access: Arc<AccessResolver>, metrics: Arc<DashboardMetrics>, ) -> Self
Create a new handler with shared resources and metrics
Sourcepub fn tool_count(&self) -> usize
pub fn tool_count(&self) -> usize
Get the number of registered tools
Trait Implementations§
Source§impl Clone for GitLabMcpHandler
impl Clone for GitLabMcpHandler
Source§fn clone(&self) -> GitLabMcpHandler
fn clone(&self) -> GitLabMcpHandler
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ServerHandler for GitLabMcpHandler
impl ServerHandler for GitLabMcpHandler
Source§async fn list_resources(
&self,
_request: Option<PaginatedRequestParam>,
_context: RequestContext<RoleServer>,
) -> Result<ListResourcesResult, McpError>
async fn list_resources( &self, _request: Option<PaginatedRequestParam>, _context: RequestContext<RoleServer>, ) -> Result<ListResourcesResult, McpError>
List available resources
Returns an empty list - resources are accessed directly by URI.
The gitlab:// URI scheme allows clients to read files from repositories.
Source§fn read_resource(
&self,
request: ReadResourceRequestParam,
_context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<ReadResourceResult, McpError>> + Send + '_
fn read_resource( &self, request: ReadResourceRequestParam, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ReadResourceResult, McpError>> + Send + '_
Read a GitLab file resource by URI
URI format: gitlab://{project}/{path}?ref={branch}
- project: URL-encoded project path (e.g.,
group%2Fsubgroup%2Fproject) - path: File path within repository
- ref: Optional git reference (branch, tag, commit) - defaults to HEAD
Source§async fn list_prompts(
&self,
_request: Option<PaginatedRequestParam>,
_context: RequestContext<RoleServer>,
) -> Result<ListPromptsResult, McpError>
async fn list_prompts( &self, _request: Option<PaginatedRequestParam>, _context: RequestContext<RoleServer>, ) -> Result<ListPromptsResult, McpError>
List available prompts
Returns built-in workflow prompts for GitLab operations.
Source§fn get_prompt(
&self,
request: GetPromptRequestParam,
_context: RequestContext<RoleServer>,
) -> impl Future<Output = Result<GetPromptResult, McpError>> + Send + '_
fn get_prompt( &self, request: GetPromptRequestParam, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<GetPromptResult, McpError>> + Send + '_
Get a specific prompt by name
Builds workflow prompts that fetch relevant GitLab data.
fn get_info(&self) -> InitializeResult
fn list_tools( &self, _request: Option<PaginatedRequestParam>, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListToolsResult, McpError>> + Send + '_
fn call_tool( &self, request: CallToolRequestParam, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CallToolResult, McpError>> + Send + '_
fn complete( &self, request: CompleteRequestParam, _context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CompleteResult, McpError>> + Send + '_
fn ping( &self, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + Send
fn initialize( &self, request: InitializeRequestParam, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<InitializeResult, ErrorData>> + Send
fn set_level( &self, request: SetLevelRequestParam, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + Send
fn list_resource_templates( &self, request: Option<PaginatedRequestParam>, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<ListResourceTemplatesResult, ErrorData>> + Send
fn subscribe( &self, request: SubscribeRequestParam, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + Send
fn unsubscribe( &self, request: UnsubscribeRequestParam, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<(), ErrorData>> + Send
fn on_custom_request( &self, request: CustomRequest, context: RequestContext<RoleServer>, ) -> impl Future<Output = Result<CustomResult, ErrorData>> + Send
fn on_cancelled( &self, notification: CancelledNotificationParam, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + Send
fn on_progress( &self, notification: ProgressNotificationParam, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + Send
fn on_initialized( &self, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + Send
fn on_roots_list_changed( &self, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + Send
fn on_custom_notification( &self, notification: CustomNotification, context: NotificationContext<RoleServer>, ) -> impl Future<Output = ()> + Send
Auto Trait Implementations§
impl Freeze for GitLabMcpHandler
impl !RefUnwindSafe for GitLabMcpHandler
impl Send for GitLabMcpHandler
impl Sync for GitLabMcpHandler
impl Unpin for GitLabMcpHandler
impl !UnwindSafe for GitLabMcpHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<R, S> DynService<R> for Swhere
R: ServiceRole,
S: Service<R>,
impl<R, S> DynService<R> for Swhere
R: ServiceRole,
S: Service<R>,
fn handle_request( &self, request: <R as ServiceRole>::PeerReq, context: RequestContext<R>, ) -> Pin<Box<dyn Future<Output = Result<<R as ServiceRole>::Resp, ErrorData>> + Send + '_>>
fn handle_notification( &self, notification: <R as ServiceRole>::PeerNot, context: NotificationContext<R>, ) -> Pin<Box<dyn Future<Output = Result<(), ErrorData>> + Send + '_>>
fn get_info(&self) -> <R as ServiceRole>::Info
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more