Skip to main content
Glama

MCP Tools for Obsidian

formatMcpError.ts578 B
import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js"; import { type } from "arktype"; export function formatMcpError(error: unknown) { if (error instanceof McpError) { return error; } if (error instanceof type.errors) { const message = error.summary; return new McpError(ErrorCode.InvalidParams, message); } if (type({ message: "string" }).allows(error)) { return new McpError(ErrorCode.InternalError, error.message); } return new McpError( ErrorCode.InternalError, "An unexpected error occurred", error, ); }

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/jacksteamdev/obsidian-mcp-tools'

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