Skip to main content
Glama
disnet
by disnet

get_note_links

Retrieve all links associated with a specific note, including incoming, outgoing internal, and external connections, to analyze relationships and connections within your note vault.

Instructions

Get all links for a specific note (incoming, outgoing internal, and external)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYesNote identifier (type/filename format)

Implementation Reference

  • Primary execution logic for the get_note_links tool: validates args, resolves vault/DB, checks note existence, extracts links via LinkExtractor.getLinksForNote, returns structured JSON response.
    handleGetNoteLinks = async (args: { identifier: string; vault_id?: string }) => {
      try {
        // Validate arguments
        validateToolArgs('get_note_links', args);
    
        const { hybridSearchManager } = await this.resolveVaultContext(args.vault_id);
        const db = await hybridSearchManager.getDatabaseConnection();
        const noteId = this.generateNoteIdFromIdentifier(args.identifier);
    
        // Check if note exists
        const note = await db.get('SELECT id FROM notes WHERE id = ?', [noteId]);
        if (!note) {
          throw new Error(`Note not found: ${args.identifier}`);
        }
    
        const links = await LinkExtractor.getLinksForNote(noteId, db);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  success: true,
                  note_id: noteId,
                  links: links
                },
                null,
                2
              )
            }
          ]
        };
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : 'Unknown error';
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  success: false,
                  error: errorMessage
                },
                null,
                2
              )
            }
          ],
          isError: true
        };
      }
    };
  • MCP tool dispatch registration in CallToolRequestSchema handler switch statement. Maps 'get_note_links' calls to LinkHandlers.handleGetNoteLinks method.
    case 'get_note_links':
      return await this.linkHandlers.handleGetNoteLinks(
        args as unknown as { identifier: string; vault_id?: string }
      );
    
    case 'get_backlinks':
      return await this.linkHandlers.handleGetBacklinks(
        args as unknown as { identifier: string; vault_id?: string }
      );
    
    case 'find_broken_links':
      return await this.linkHandlers.handleFindBrokenLinks(
        args as unknown as { vault_id?: string }
      );
    
    case 'search_by_links':
      return await this.linkHandlers.handleSearchByLinks(
        args as unknown as {
          has_links_to?: string[];
          linked_from?: string[];
          external_domains?: string[];
          broken_links?: boolean;
          vault_id?: string;
        }
      );
    
    case 'migrate_links':
      return await this.linkHandlers.handleMigrateLinks(
        args as unknown as { force?: boolean; vault_id?: string }
      );
  • Input schema definition for get_note_links tool, defining required 'identifier' parameter and optional 'vault_id'.
      name: 'get_note_links',
      description:
        'Get all links for a specific note (incoming, outgoing internal, and external)',
      inputSchema: {
        type: 'object',
        properties: {
          identifier: {
            type: 'string',
            description: 'Note identifier (type/filename format)'
          },
          vault_id: {
            type: 'string',
            description:
              'Optional vault ID to operate on. If not provided, uses the current active vault.'
          }
        },
        required: ['identifier']
      }
    },
  • Runtime argument validation rules for get_note_links tool args, ensuring identifier format 'type/filename'.
    get_note_links: [
      {
        field: 'identifier',
        required: true,
        type: 'string',
        allowEmpty: false,
        customValidator: (value: any) => {
          if (!value.includes('/')) {
            return 'identifier must be in format "type/filename"';
          }
          const parts = value.split('/');
          if (parts.length !== 2 || !parts[0] || !parts[1]) {
            return 'identifier must be in format "type/filename" with both parts non-empty';
          }
          return null;
        }
      },
      {
        field: 'vault_id',
        required: false,
        type: 'string',
        allowEmpty: false
      }
    ],
  • src/server.ts:158-162 (registration)
    Instantiation of LinkHandlers class instance used by get_note_links (and related link tools), injecting vault resolver and note ID generator.
    // Initialize link handlers
    this.linkHandlers = new LinkHandlers(
      this.#resolveVaultContext.bind(this),
      this.#generateNoteIdFromIdentifier.bind(this)
    );
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 critical details: it doesn't specify if this is a read-only operation (implied by 'Get' but not explicit), whether it requires specific permissions, how results are formatted (e.g., list structure), or if there are rate limits. For a tool with zero annotation coverage, this is a significant gap in transparency.

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 front-loads the core purpose ('Get all links for a specific note') and adds clarifying detail ('incoming, outgoing internal, and external') without redundancy. Every word earns its place, making it easy to parse quickly, with no wasted verbiage or structural issues.

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?

Given the tool's moderate complexity (retrieving multiple link types), lack of annotations, and no output schema, the description is minimally adequate but incomplete. It covers the basic purpose but misses behavioral context (e.g., safety, permissions) and output details. With 100% schema coverage for the single parameter, it's not severely lacking, but more completeness would help compensate for missing structured data.

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 input schema has 100% description coverage, with the single parameter 'identifier' documented as 'Note identifier (type/filename format)'. The description adds no additional parameter semantics beyond what the schema provides—it doesn't clarify the identifier format further or provide examples. Baseline 3 is appropriate since the schema does the heavy lifting, but no extra value is added.

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 ('for a specific note'), specifying the types of links retrieved (incoming, outgoing internal, and external). It distinguishes from siblings like 'get_backlinks' (which likely only retrieves incoming links) and 'find_broken_links' (which focuses on problematic links). However, it doesn't explicitly contrast with 'search_by_links' or 'migrate_links', leaving some ambiguity.

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. It doesn't mention when to prefer 'get_backlinks' for only incoming links, 'search_by_links' for link-based searches, or 'find_broken_links' for identifying issues. There's also no context about prerequisites (e.g., note must exist) or exclusions, leaving usage decisions to inference from tool names alone.

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/disnet/flint-note'

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