elastic / elastic/semantic-code-search-mcp-server
Complete rename of list_symbols_by_query to map_symbols_by_query
- Dominant language
- TypeScript
- Stars
- 12
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
# Refactoring: Complete Rename of list_symbols_by_query to map_symbols_by_query
## Overview
Complete the renaming of `list_symbols_by_query` to `map_symbols_by_query` throughout the codebase. The tool is already registered as `map_symbols_by_query` in the MCP server, but the underlying implementation files still use the old name. This refactoring improves consistency and clarity, as "map" better describes the structured, file-by-file output format.
## Current State
- ✅ Tool registered as `map_symbols_by_query` in `server.ts`
- ✅ Documentation file already named `map_symbols_by_query.md`
- ❌ Implementation file still named `list_symbols_by_query.ts`
- ❌ Test file still named `list_symbols_by_query.test.ts`
- ❌ Function and schema names still use `listSymbolsByQuery`
- ❌ Legacy documentation file `list_symbols_by_query.md` still exists
## Implementation Roadmap
### Task 1: Rename Implementation File ✅
**File**: `src/mcp_server/tools/list_symbols_by_query.ts` → `src/mcp_server/tools/map_symbols_by_query.ts`
**Changes**:
- Rename the file from `list_symbols_by_query.ts` to `map_symbols_by_query.ts`
- Update all function names: `listSymbolsByQuery` → `mapSymbolsByQuery`
- Update schema name: `listSymbolsByQuerySchema` → `mapSymbolsByQuerySchema`
- Update type name: `ListSymbolsByQueryParams` → `MapSymbolsByQueryParams`
- Update all internal references and comments
**Why**: Align implementation file name with the exposed tool name for consistency.
**Dependencies**: None
### Task 2: Update Server Registration ✅
**File**: `src/mcp_server/server.ts`
**Changes**:
- Update import statement to use new file name and function name
- Update schema import name
- Verify tool registration still uses `map_symbols_by_query` (should already be correct)
**Why**: Import paths and names must match the renamed implementation.
**Dependencies**: Task 1
**Key Details**:
```typescript
// Before
import { listSymbolsByQuery, listSymbolsByQuerySchema } from './tools/list_symbols_by_query';
// After
import { mapSymbolsByQuery, mapSymbolsByQuerySchema } from './tools/map_symbols_by_query';
```
### Task 3: Rename Test File ✅
**File**: `tests/mcp_server/list_symbols_by_query.test.ts` → `tests/mcp_server/map_symbols_by_query.test.ts`
**Changes**:
- Rename the test file from `list_symbols_by_query.test.ts` to `map_symbols_by_query.test.ts`
- Update all imports to use new function and schema names
- Update test suite descriptions from `'list_symbols_by_query'` to `'map_symbols_by_query'`
- Update function calls to use `mapSymbolsByQuery`
**Why**: Test file names should match implementation file names.
**Dependencies**: Task 1
### Task 4: Delete Legacy Documentation ✅
**File**: `src/mcp_server/tools/list_symbols_by_query.md`
**Changes**:
- Delete the file `list_symbols_by_query.md`
- This file is redundant as `map_symbols_by_query.md` already exists with updated content
**Why**: Remove obsolete documentation to avoid confusion.
**Dependencies**: None
**Note**: Verify `map_symbols_by_query.md` has all necessary content before deletion.
### Task 5: Update JSDoc Comments ✅
**File**: `src/mcp_server/tools/map_symbols_by_query.ts`
**Changes**:
- Update JSDoc comment for the main function to reference `mapSymbolsByQuery`
- Update schema JSDoc to reference `mapSymbolsByQuery` tool
- Update any internal comments referencing the old name
**Why**: Documentation should use the correct function name.
**Dependencies**: Task 1
### Task 6: Search and Replace Remaining References ✅
**Files**: All files in the codebase
**Changes**:
- Search for any remaining references to `list_symbols_by_query` or `listSymbolsByQuery`
- Update comments, documentation, or error messages that might reference the old name
- Check for any import statements that might have been missed
**Why**: Ensure complete consistency across the codebase.
**Dependencies**: Tasks 1-5
**Note**: This is a verification task to catch any edge cases.
### Task 7: Verify Build and Tests ✅
**Files**: All test files
**Changes**:
- Ensure all tests pass with the new names
- Verify TypeScript compilation succeeds
- Run linter to catch any issues
**Why**: Confirm the refactoring didn't break anything.
**Dependencies**: Tasks 1-6
## Technical Details
### File Rename Summary
```
src/mcp_server/tools/
list_symbols_by_query.ts → map_symbols_by_query.ts
list_symbols_by_query.md → [DELETE]
map_symbols_by_query.md [KEEP - already exists]
tests/mcp_server/
list_symbols_by_query.test.ts → map_symbols_by_query.test.ts
```
### Function Signature Changes
```typescript
// Before
export const listSymbolsByQuerySchema = z.object({ ... });
export type ListSymbolsByQueryParams = z.infer;
export async function listSymbolsByQuery(params: ListSymbolsByQueryParams): Promise { ... }
// After
export const mapSymbolsByQuerySchema = z.object({ ... });
export type MapSymbolsByQueryParams = z.infer;
export async function mapSymbolsByQuery(params: MapSymbolsByQueryParams): Promise { ... }
```
### Import Updates in server.ts
```typescript
// Before (lines 11-12)
import { listSymbolsByQuery, listSymbolsByQuerySchema } from './tools/list_symbols_by_query';
// After
import { mapSymbolsByQuery, mapSymbolsByQuerySchema } from './tools/map_symbols_by_query';
// Tool registration (lines 59-66) - should already use 'map_symbols_by_query'
this.server.registerTool(
'map_symbols_by_query',
{
description: mapSymbolsByQueryDescription,
inputSchema: mapSymbolsByQuerySchema.shape,
},
mapSymbolsByQuery
);
```
### Test File Updates
```typescript
// Before
import { listSymbolsByQuery } from '../../src/mcp_server/tools/list_symbols_by_query';
describe('list_symbols_by_query', () => { ... });
const result = await listSymbolsByQuery({ kql: '...' });
// After
import { mapSymbolsByQuery } from '../../src/mcp_server/tools/map_symbols_by_query';
describe('map_symbols_by_query', () => { ... });
const result = await mapSymbolsByQuery({ kql: '...' });
```
## Breaking Changes
**None** - This is purely an internal refactoring. The tool is already registered as `map_symbols_by_query` in the MCP server, so external consumers won't be affected.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.