Class: API::Mcp::Base

Inherits:
Base
  • Object
show all
Includes:
APIGuard, Helpers::HeadersHelpers, Mcp::Tools::VersionHelper
Defined in:
lib/api/mcp/base.rb

Constant Summary collapse

JSONRPC_VERSION =

JSON-RPC Specification See: www.jsonrpc.org/specification

'2.0'
JSONRPC_ERRORS =

JSON-RPC Error Codes See: www.jsonrpc.org/specification#error_object

{
  invalid_request: {
    code: -32600,
    message: 'Invalid Request'
  },
  method_not_found: {
    code: -32601,
    message: 'Method not found'
  },
  invalid_params: {
    code: -32602,
    message: 'Invalid params'
  },
  version_mismatch: {
    code: -32001,
    message: 'Version not supported'
  }
  # NOTE: Parse error code -32700 is unsupported due to 400 Bad Request returned by Workhorse
}.freeze
JSONRPC_METHOD_HANDLERS =
{
  'initialize' => Handlers::InitializeRequest,
  'notifications/initialized' => Handlers::InitializedNotificationRequest
}.freeze

Constants included from Gitlab::NoCacheHeaders

Gitlab::NoCacheHeaders::DEFAULT_GITLAB_NO_CACHE_HEADERS

Constants included from Gitlab::EndpointAttributes

Gitlab::EndpointAttributes::DEFAULT_URGENCY

Method Summary

Methods included from Mcp::Tools::VersionHelper

#validate_semantic_version

Methods included from Helpers::HeadersHelpers

#no_cache_headers, #set_http_headers

Methods included from Gitlab::NoCacheHeaders

#no_cache_headers

Methods inherited from Base

endpoint_id_for_route, feature_category_for_app, path_for_app, route, urgency_for_app