Skip to main content
Glama
lib.rs1.68 kB
use std::fmt; use axum::{ Json, http::StatusCode, }; pub mod change_set; pub mod request; pub mod services; pub mod v1; pub mod workspace; pub use services::*; pub type ErrorResponse = (StatusCode, Json<serde_json::Value>); pub fn internal_error(message: impl fmt::Display) -> ErrorResponse { let status_code = StatusCode::INTERNAL_SERVER_ERROR; ( status_code, Json(serde_json::json!({ "error": { "message": message.to_string(), "statusCode": status_code.as_u16(), "code": 42, }, })), ) } pub fn bad_request(message: impl fmt::Display) -> ErrorResponse { let status_code = StatusCode::BAD_REQUEST; ( status_code, Json(serde_json::json!({ "error": { "message": message.to_string(), "statusCode": status_code.as_u16(), "code": 42, }, })), ) } pub fn unauthorized_error(message: impl fmt::Display) -> ErrorResponse { let status_code = StatusCode::UNAUTHORIZED; ( status_code, Json(serde_json::json!({ "error": { "message": message.to_string(), "statusCode": status_code.as_u16(), "code": 42, }, })), ) } pub fn not_found_error(message: &str) -> ErrorResponse { let status_code = StatusCode::NOT_FOUND; ( status_code, Json(serde_json::json!({ "error": { "message": message, "statusCode": status_code.as_u16(), "code": 42, }, })), ) }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server