Skip to main content
Glama
disnet
by disnet

get_backlinks

Retrieve all notes that link to a specified note in your Flint Note vault. Identify backlinks to understand connections between your notes.

Instructions

Get all notes that link to the specified note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifierYesNote identifier (type/filename format)

Implementation Reference

  • Main handler method for the get_backlinks tool. Validates input, resolves database context, verifies note existence, queries backlinks using LinkExtractor, and returns JSON-formatted response.
    handleGetBacklinks = async (args: { identifier: string; vault_id?: string }) => {
      try {
        // Validate arguments
        validateToolArgs('get_backlinks', 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 backlinks = await LinkExtractor.getBacklinks(noteId, db);
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(
                {
                  success: true,
                  note_id: noteId,
                  backlinks: backlinks
                },
                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
        };
      }
    };
  • Tool registration in the MCP CallToolRequestSchema handler switch statement, dispatching to LinkHandlers.handleGetBacklinks.
    return await this.linkHandlers.handleGetBacklinks(
      args as unknown as { identifier: string; vault_id?: string }
    );
  • Tool schema definition returned by ListToolsRequestSchema, specifying input requirements (identifier required).
      name: 'get_backlinks',
      description: 'Get all notes that link to the specified note',
      inputSchema: {
        type: 'object',
        properties: {
          identifier: {
            type: 'string',
            description: 'Note identifier (type/filename format)'
          }
        },
        required: ['identifier']
      }
    },
  • Core helper method that executes the SQL query to fetch all incoming links (backlinks) from the note_links table for the given note ID.
    static async getBacklinks(
      noteId: string,
      db: DatabaseConnection
    ): Promise<NoteLinkRow[]> {
      return await db.all<NoteLinkRow>(
        `SELECT * FROM note_links WHERE target_note_id = ? ORDER BY created DESC`,
        [noteId]
      );
    }
  • Input validation rules for get_backlinks tool arguments, ensuring identifier is in 'type/filename' format.
    get_backlinks: [
      {
        field: 'identifier',
        required: true,
        type: 'string',
        allowEmpty: false,
        customValidator: (value: string) => {
          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
      }
    ],
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes a read operation ('Get'), which implies it's non-destructive, but doesn't specify permissions, rate limits, return format, or pagination behavior. This leaves significant gaps for an agent to understand how to interact with the tool effectively.

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, clear sentence that directly states the tool's purpose without any unnecessary words. It is front-loaded and efficiently conveys the core functionality, making it easy to parse and understand quickly.

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 the lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., a list of notes, their details, or just identifiers), nor does it cover behavioral aspects like error handling or performance considerations. For a tool with one parameter but no structured output information, 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 input schema has 100% description coverage, with the 'identifier' parameter documented as 'Note identifier (type/filename format)'. The description adds no additional meaning beyond this, as it doesn't elaborate on the parameter's usage or constraints. The baseline score of 3 is appropriate since the schema handles the parameter documentation adequately.

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 verb ('Get') and resource ('all notes that link to the specified note'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_note_links' or 'search_by_links', which might have overlapping functionality, so it doesn't reach the highest score.

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 such as 'get_note_links' or 'search_by_links', nor does it mention any prerequisites or exclusions. It merely states what the tool does without contextual usage information.

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