Skip to main content
Glama

get_outlinks

Extract all outgoing links from a specific Obsidian note to analyze connections and reference external content.

Instructions

Get all links from a specific note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesThe note path (relative to vault root)

Implementation Reference

  • The tool 'get_outlinks' is registered and implemented in src/tools/links.ts. It reads the contents of the specified note, extracts wikilinks, resolves them, and returns a formatted report of valid and broken outgoing links.
    // ── get_outlinks ───────────────────────────────────────────────
    server.registerTool(
      "get_outlinks",
      {
        description: "Get all links from a specific note",
        inputSchema: {
          path: z.string().min(1).describe("The note path (relative to vault root)"),
        },
      },
      async ({ path: notePath }) => {
        try {
          const allNotes = await listNotes(vaultPath);
          const content = await readNote(vaultPath, notePath);
          const links = extractWikilinks(content);
    
          const results: { target: string; resolvedPath: string | null; isValid: boolean; isEmbed: boolean }[] = [];
    
          for (const link of links) {
            const targetBase = link.target.split("#")[0].trim();
            if (!targetBase) continue;
    
            const resolved = resolveWikilink(targetBase, notePath, allNotes);
            results.push({
              target: link.target,
              resolvedPath: resolved,
              isValid: resolved !== null,
              isEmbed: link.isEmbed,
            });
          }
    
          if (results.length === 0) {
            return {
              content: [
                {
                  type: "text" as const,
                  text: `No outgoing links found in: ${notePath}`,
                },
              ],
            };
          }
    
          const valid = results.filter((r) => r.isValid);
          const broken = results.filter((r) => !r.isValid);
    
          const lines: string[] = [
            `Outgoing links from: ${notePath}`,
            `Total: ${results.length} (${valid.length} valid, ${broken.length} broken)\n`,
          ];
    
          if (valid.length > 0) {
            lines.push("Valid links:");
            for (const r of valid) {
              const embedPrefix = r.isEmbed ? "📎 " : "";
              lines.push(`  ${embedPrefix}[[${r.target}]] → ${r.resolvedPath}`);
            }
          }
    
          if (broken.length > 0) {
            lines.push("\nBroken links:");
            for (const r of broken) {
              const embedPrefix = r.isEmbed ? "📎 " : "";
              lines.push(`  ${embedPrefix}[[${r.target}]] → (not found)`);
            }
          }
    
          return { content: [{ type: "text" as const, text: lines.join("\n") }] };
        } catch (err) {
          console.error("get_outlinks error:", err);
          return errorResult(`Error getting outlinks: ${err instanceof Error ? err.message : String(err)}`);
        }
      },
    );
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but lacks crucial details: whether it's read-only, what format the links are returned in, if there are rate limits, or if specific permissions are needed. For a tool with zero annotation coverage, this is insufficient.

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?

The description is a single, efficient sentence that gets straight to the point with zero wasted words. It's appropriately sized for a simple tool and front-loads the core functionality.

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

Completeness2/5

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

Given no annotations and no output schema, the description is incomplete. It doesn't explain what 'links' means in this context (e.g., markdown links, wikilinks), what the return format looks like, or any error conditions. For a tool that presumably returns data, more context is needed.

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

Parameters3/5

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

The schema has 100% description coverage, with the 'path' parameter clearly documented as 'The note path (relative to vault root)'. The description adds no additional parameter information beyond what's in the schema, so it meets the baseline but doesn't enhance understanding.

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

Purpose4/5

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

The description clearly states the action ('Get all links') and target resource ('from a specific note'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'find_broken_links' or 'get_backlinks' which also deal with links, leaving some ambiguity about scope.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'find_broken_links' or 'get_backlinks'. It mentions 'all links' but doesn't specify what types of links (e.g., internal, external) or clarify exclusions, leaving the agent to infer usage context.

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

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