Skip to main content
Glama
takuya0206

Obsidian MCP

by takuya0206

readActiveNote

Retrieve the content of your currently open note in Obsidian to access information for AI-assisted tasks.

Instructions

Read the contents of the current active note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main tool handler factory function that creates the executor for the 'readActiveNote' tool. It calls the ObsidianAPI's readActiveNote method and formats the success or error response.
    export function createReadActiveNoteTool(api: ObsidianAPI): ToolHandler {
      return async (): Promise<ToolResponse> => {
        try {
          const note = await api.readActiveNote();
          return formatSuccessResponse(note);
        } catch (error) {
          return formatErrorResponse(`Error reading active note: ${(error as Error).message}`);
        }
      };
    }
  • The tool definition including name, description, and schema (empty object for no parameters). The schema is defined earlier as ReadActiveNoteSchema = {}.
    export const readActiveNoteDefinition: ToolDefinition = {
      name: "readActiveNote",
      description: "Read the contents of the current active note",
      schema: ReadActiveNoteSchema
    };
  • src/server.ts:56-60 (registration)
    Registers the 'readActiveNote' tool with the MCP server by calling server.tool with the definition and the created handler.
      readActiveNoteDefinition.name,
      readActiveNoteDefinition.description,
      readActiveNoteDefinition.schema,
      createReadActiveNoteTool(this.api)
    );
  • The underlying API method in ObsidianAPI that performs the HTTP GET request to retrieve the active note contents.
    async readActiveNote(): Promise<NoteJson> {
      const response = await this.client.get(`/active/`, {
        headers: {
          ...this.defaultHeaders,
          "Content-Type": "application/json",
          accept: "application/vnd.olrapi.note+json",
        },
      });
      return response.data as NoteJson;
    }

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

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