buildLspTools function

List<Tool> buildLspTools()

The Tool definitions for the LSP inspection tools. These are the single source of truth advertised via tools/list.

Implementation

List<Tool> buildLspTools() => [
  Tool(
    name: lspDiagnosticsToolName,
    description:
        'Analyze source code and return its diagnostics (errors/warnings) with '
        'precise LSP line/character ranges.',
    inputSchema: _wholeFileSchema(),
  ),
  Tool(
    name: lspSymbolsToolName,
    description:
        'Return the document outline: a hierarchy of symbols (classes, methods, '
        'fields, enums, functions, variables) with their source ranges.',
    inputSchema: _wholeFileSchema(),
  ),
  Tool(
    name: lspHoverToolName,
    description:
        'Return hover information (signature, type and documentation) for the '
        'symbol at a line/character position.',
    inputSchema: _positionalSchema(),
  ),
  Tool(
    name: lspDefinitionToolName,
    description:
        'Return the declaration location (URI + range) of the symbol at a '
        'line/character position.',
    inputSchema: _positionalSchema(),
  ),
  Tool(
    name: lspReferencesToolName,
    description:
        'Return every reference to the symbol at a line/character position.',
    inputSchema: _positionalSchema(
      extra: {
        'includeDeclaration': Schema.bool(
          description: 'Include the declaration itself (default true).',
        ),
      },
    ),
  ),
  Tool(
    name: lspCompletionToolName,
    description:
        'Return completion proposals (symbols and keywords) at a line/character '
        'position.',
    inputSchema: _positionalSchema(),
  ),
  Tool(
    name: lspWorkspaceSymbolsToolName,
    description:
        'Search declarations matching a query across a set of in-memory files '
        '— codebase-wide symbol lookup.',
    inputSchema: ObjectSchema(
      properties: {
        'query': Schema.string(
          description:
              'Case-insensitive substring to match (empty matches '
              'all).',
        ),
        'files': Schema.list(
          description: 'The files that make up the workspace.',
          items: ObjectSchema(
            properties: {
              'uri': Schema.string(description: 'File URI/path.'),
              'source': _sourceSchema,
              'language': Schema.string(
                description:
                    'Optional language override ($_languageValues); inferred '
                    'from the URI extension when omitted.',
              ),
            },
            required: ['uri', 'source'],
          ),
        ),
      },
      required: ['query', 'files'],
    ),
  ),
];