obsidian-mcp-server
Version:
Obsidian Knowledge-Management MCP (Model Context Protocol) server that enables AI agents and development tools to interact with an Obsidian vault. It provides a comprehensive suite of tools for reading, writing, searching, and managing notes, tags, and fr
32 lines (31 loc) • 1.05 kB
JavaScript
/**
* @module CommandMethods
* @description
* Methods for interacting with Obsidian commands via the REST API.
*/
/**
* Executes a registered Obsidian command by its ID.
* @param _request - The internal request function from the service instance.
* @param commandId - The ID of the command (e.g., "app:go-back").
* @param context - Request context.
* @returns {Promise<void>} Resolves on success (204 No Content).
*/
export async function executeCommand(_request, commandId, context) {
await _request({
method: "POST",
url: `/commands/${encodeURIComponent(commandId)}/`,
}, context, "executeCommand");
}
/**
* Lists all available Obsidian commands.
* @param _request - The internal request function from the service instance.
* @param context - Request context.
* @returns A list of available commands.
*/
export async function listCommands(_request, context) {
const response = await _request({
method: "GET",
url: "/commands/",
}, context, "listCommands");
return response.commands;
}