obsidian-mcp-server
Version:
MCP server for Obsidian vaults — read, write, search, and surgically edit notes, tags, and frontmatter via the Local REST API plugin. STDIO or Streamable HTTP.
34 lines • 1.56 kB
TypeScript
/**
* @fileoverview Read-modify-write helpers for the YAML frontmatter block of a
* note's raw content. Used by the composed manage-frontmatter / manage-tags
* tools when the upstream Local REST API has no single-call equivalent.
* @module services/obsidian/frontmatter-ops
*/
/**
* Returns the full file content with `key` removed from the frontmatter.
* If the file has no frontmatter or the key isn't present, returns content
* unchanged.
*/
export declare function deleteFrontmatterKey(content: string, key: string): string;
export interface TagReconcileResult {
/** Tags actually changed (added/removed) at one or more locations. */
applied: string[];
/** Updated content with the requested tag mutations applied. */
content: string;
/** Tags that were already in the desired state at the targeted location(s). */
skipped: string[];
}
export type TagOperation = 'add' | 'remove';
export type TagLocation = 'frontmatter' | 'inline' | 'both';
/**
* Add or remove tags across frontmatter (`tags:` array) and inline `#tag`
* syntax. Inline occurrences inside fenced code blocks are left alone — they
* are code, not tags.
*/
export declare function reconcileTags(content: string, tags: string[], operation: TagOperation, location: TagLocation): TagReconcileResult;
/** Read-only helpers for `obsidian_manage_tags list`. */
export declare function listTagsFromContent(content: string, frontmatter: Record<string, unknown>): {
frontmatter: string[];
inline: string[];
};
//# sourceMappingURL=frontmatter-ops.d.ts.map