Skip to main content
Glama
bezata

kObsidian MCP

Initialize Wiki

wiki.init
Idempotent

Scaffold a wiki layout in your Obsidian vault, generating Sources/, Concepts/, Entities/ folders and seed index, log, schema files. Idempotent; force re-seeds.

Instructions

Scaffold the wiki layout: Sources/, Concepts/, Entities/ folders plus seed index.md, log.md, and wiki-schema.md. Idempotent; use force:true to re-seed index/log/schema files.

Operates on the session-active vault (see vault.current — selectable via vault.select) unless an explicit vaultPath argument is passed, which always wins.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
wikiRootNo
forceNo
vaultPathNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
changedYesTrue if the tool altered vault state on this call; false if it was a no-op.
targetYesThe path or identifier the tool acted on.
summaryYesShort human-readable summary of what happened.

Implementation Reference

  • The main handler function for wiki.init. Creates the wiki folder structure (Sources/, Concepts/, Entities/) and seeds index.md, log.md, and wiki-schema.md. Supports force re-seeding via the force flag.
    export async function initWiki(context: DomainContext, args: WikiInitArgs) {
      const paths = resolveWikiPaths(context, args);
      const force = args.force ?? false;
      const created: string[] = [];
    
      const folders: Array<{ absolute: string; relative: string }> = [
        { absolute: paths.rootAbsolute, relative: paths.rootRelative },
        { absolute: paths.sourcesAbsolute, relative: paths.sourcesRelative },
        { absolute: paths.conceptsAbsolute, relative: paths.conceptsRelative },
        { absolute: paths.entitiesAbsolute, relative: paths.entitiesRelative },
      ];
    
      for (const { absolute, relative } of folders) {
        if (await fileExists(absolute)) continue;
        await ensureDir(absolute);
        created.push(relative);
      }
    
      const seeds: Array<{ absolute: string; relative: string; content: string }> = [
        { absolute: paths.indexAbsolute, relative: paths.indexRelative, content: INDEX_SEED },
        { absolute: paths.logAbsolute, relative: paths.logRelative, content: LOG_SEED },
        { absolute: paths.schemaAbsolute, relative: paths.schemaRelative, content: SCHEMA_SEED },
      ];
    
      for (const seed of seeds) {
        const existed = await fileExists(seed.absolute);
        if (existed && !force) continue;
        await writeUtf8(seed.absolute, seed.content);
        if (!existed) created.push(seed.relative);
      }
    
      const changed = created.length > 0 || force;
      return {
        changed,
        target: paths.rootRelative,
        summary:
          created.length > 0
            ? `Initialized wiki at ${paths.rootRelative} (${created.length} new)`
            : force
              ? `Re-seeded wiki at ${paths.rootRelative}`
              : `Wiki at ${paths.rootRelative} already initialized`,
        created,
        wikiRoot: paths.rootRelative,
        force,
      };
    }
  • Zod schema (wikiInitArgsSchema) for wiki.init input: optional wikiRoot override, force boolean, and vaultPath.
    export const wikiInitArgsSchema = z.object({
      wikiRoot: wikiRootOverrideSchema,
      force: z.boolean().optional(),
      vaultPath: z.string().optional(),
    });
    export type WikiInitArgs = z.input<typeof wikiInitArgsSchema>;
  • Tool registration for wiki.init in the wikiTools array with name, title, description, schemas, annotations, and handler delegating to initWiki.
    {
      name: "wiki.init",
      title: "Initialize Wiki",
      description:
        "Scaffold the wiki layout: Sources/, Concepts/, Entities/ folders plus seed index.md, log.md, and wiki-schema.md. Idempotent; use force:true to re-seed index/log/schema files.",
      inputSchema: wikiInitArgsSchema,
      outputSchema: mutationResultSchema,
      annotations: IDEMPOTENT,
      handler: (context, args) => initWiki(context, args as Parameters<typeof initWiki>[1]),
    },
  • resolveWikiPaths helper used by initWiki to resolve all wiki folder and file paths based on context and args.
    export function resolveWikiPaths(
      context: DomainContext,
      args: ResolveWikiPathsArgs = {},
    ): WikiPaths {
      const vaultRoot = requireVaultPath(context, args.vaultPath);
      const rootRelative = sanitizeWikiRoot(args.wikiRoot ?? context.env.KOBSIDIAN_WIKI_ROOT);
      const rootAbsolute = resolveVaultPath(vaultRoot, rootRelative);
    
      const sourcesDirName = context.env.KOBSIDIAN_WIKI_SOURCES_DIR;
      const conceptsDirName = context.env.KOBSIDIAN_WIKI_CONCEPTS_DIR;
      const entitiesDirName = context.env.KOBSIDIAN_WIKI_ENTITIES_DIR;
      const indexFileName = context.env.KOBSIDIAN_WIKI_INDEX_FILE;
      const logFileName = context.env.KOBSIDIAN_WIKI_LOG_FILE;
      const schemaFileName = context.env.KOBSIDIAN_WIKI_SCHEMA_FILE;
    
      const join = (...parts: string[]) => parts.join("/");
    
      return {
        vaultRoot,
        rootRelative,
        rootAbsolute,
        sourcesDirName,
        conceptsDirName,
        entitiesDirName,
        indexFileName,
        logFileName,
        schemaFileName,
        sourcesRelative: join(rootRelative, sourcesDirName),
        conceptsRelative: join(rootRelative, conceptsDirName),
        entitiesRelative: join(rootRelative, entitiesDirName),
        indexRelative: join(rootRelative, indexFileName),
        logRelative: join(rootRelative, logFileName),
        schemaRelative: join(rootRelative, schemaFileName),
        sourcesAbsolute: path.join(rootAbsolute, sourcesDirName),
        conceptsAbsolute: path.join(rootAbsolute, conceptsDirName),
        entitiesAbsolute: path.join(rootAbsolute, entitiesDirName),
        indexAbsolute: path.join(rootAbsolute, indexFileName),
        logAbsolute: path.join(rootAbsolute, logFileName),
        schemaAbsolute: path.join(rootAbsolute, schemaFileName),
      };
    }
  • Helper functions providing body skeletons for source/concept/entity pages (not directly called by initWiki, but part of wiki domain schema utilities).
    export function sourceBodySkeleton(): string {
      return SOURCE_SKELETON;
    }
    
    export function conceptBodySkeleton(): string {
      return CONCEPT_SKELETON;
    }
    
    export function entityBodySkeleton(): string {
      return ENTITY_SKELETON;
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds beyond annotations by detailing idempotency, force re-seeding, and vault selection behavior. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with front-loaded main action, no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers vault selection and idempotency, but lacks explanation of wikiRoot parameter, which is essential for correct usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so description must explain parameters. It covers force and vaultPath but omits wikiRoot, which is critical and not explained in the schema either.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool scaffolds the wiki layout with specific folders and seed files, distinguishing it from sibling tools like wiki.ingest and wiki.query.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains idempotency and the force parameter for re-seeding, and clarifies vault selection precedence. However, it does not explicitly state when not to use it or compare with alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/bezata/kObsidian'

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