Skip to content

Commit ed504c1

Browse files
committed
Fix linting errors in MCP Slack module
- Remove unused SearchMessagesDto import - Remove unused processedCount variable - Remove unused since parameter from destructuring - Remove unused SearchMessagesOptions import - Prefix unused accessToken parameter with underscore - Apply linter formatting fixes to MCP core modules
1 parent c0ca73c commit ed504c1

File tree

7 files changed

+18
-52
lines changed

7 files changed

+18
-52
lines changed

backend/src/modules/mcp-slack/controllers/mcp-slack.controller.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { McpSlackService } from '../services/mcp-slack.service';
1313
import {
1414
SyncChannelDto,
1515
GetMessagesDto,
16-
SearchMessagesDto,
1716
ProcessAudioDto,
1817
SyncAudioDto,
1918
} from '../dto/slack-mcp.dto';
@@ -190,10 +189,7 @@ export class McpSlackController {
190189
@Get('audio/:channelId')
191190
@ApiOperation({ summary: 'Get audio recordings from a Slack channel' })
192191
@ApiResponse({ status: 200, description: 'Audio recordings retrieved' })
193-
async getAudioRecordings(
194-
@Param('channelId') channelId: string,
195-
@Query('since') since?: string,
196-
) {
192+
async getAudioRecordings(@Param('channelId') channelId: string, @Query('since') since?: string) {
197193
try {
198194
const sinceDate = since ? new Date(since) : undefined;
199195
const recordings = await this.mcpSlackService.getAudioRecordings(channelId, sinceDate);
@@ -252,14 +248,10 @@ export class McpSlackController {
252248
async syncAudio(@Body() dto: SyncAudioDto) {
253249
try {
254250
const sinceDate = dto.since ? new Date(dto.since) : undefined;
255-
const recordings = await this.mcpSlackService.getAudioRecordings(
256-
dto.channelId,
257-
sinceDate,
258-
);
251+
const recordings = await this.mcpSlackService.getAudioRecordings(dto.channelId, sinceDate);
259252

260253
// Process each recording (limit to dto.limit if specified)
261254
const toProcess = dto.limit ? recordings.slice(0, dto.limit) : recordings;
262-
const processedCount = 0;
263255

264256
for (const recording of toProcess) {
265257
try {

backend/src/modules/mcp-slack/processors/slack-audio.processor.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,8 @@ export class SlackAudioProcessor {
8787
* Process bulk audio sync
8888
*/
8989
@Process('bulk-sync')
90-
async handleBulkSync(
91-
job: Job<{ channelId: string; fileIds: string[]; since?: Date }>,
92-
) {
93-
const { channelId, fileIds, since } = job.data;
90+
async handleBulkSync(job: Job<{ channelId: string; fileIds: string[]; since?: Date }>) {
91+
const { channelId, fileIds } = job.data;
9492

9593
this.logger.log(`Processing bulk audio sync for channel ${channelId}: ${fileIds.length} files`);
9694

backend/src/modules/mcp-slack/services/mcp-slack.service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
SlackFile,
1313
SlackAudioRecording,
1414
GetChannelMessagesOptions,
15-
SearchMessagesOptions,
1615
SlackSyncResult,
1716
} from '../interfaces/slack-mcp.interface';
1817

@@ -210,7 +209,7 @@ export class McpSlackService implements OnModuleInit {
210209
/**
211210
* Download file
212211
*/
213-
async downloadFile(fileUrl: string, accessToken?: string): Promise<Buffer> {
212+
async downloadFile(fileUrl: string, _accessToken?: string): Promise<Buffer> {
214213
this.logger.debug(`Downloading file from ${fileUrl}`);
215214

216215
try {

backend/src/modules/mcp/exceptions/mcp.exceptions.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ export class MCPToolException extends MCPException {
4848
*/
4949
export class MCPToolNotFoundException extends MCPException {
5050
constructor(toolName: string, serverName: string) {
51-
super(
52-
`MCP tool '${toolName}' not found on server '${serverName}'`,
53-
HttpStatus.NOT_FOUND,
54-
);
51+
super(`MCP tool '${toolName}' not found on server '${serverName}'`, HttpStatus.NOT_FOUND);
5552
this.name = 'MCPToolNotFoundException';
5653
}
5754
}

backend/src/modules/mcp/mcp.module.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,7 @@ import { MCPToolInvokerService } from './services/mcp-tool-invoker.service';
1010
*/
1111
@Module({
1212
imports: [ConfigModule],
13-
providers: [
14-
MCPClientService,
15-
MCPConnectionManagerService,
16-
MCPToolInvokerService,
17-
],
18-
exports: [
19-
MCPClientService,
20-
MCPConnectionManagerService,
21-
MCPToolInvokerService,
22-
],
13+
providers: [MCPClientService, MCPConnectionManagerService, MCPToolInvokerService],
14+
exports: [MCPClientService, MCPConnectionManagerService, MCPToolInvokerService],
2315
})
2416
export class MCPModule {}

backend/src/modules/mcp/services/mcp-connection-manager.service.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import { Injectable, Logger, OnModuleInit } from '@nestjs/common';
22
import { ConfigService } from '@nestjs/config';
33
import { MCPClientService } from './mcp-client.service';
4-
import {
5-
getMCPServersConfig,
6-
isMCPEnabled,
7-
validateMCPServerConfig,
8-
} from '../config/mcp.config';
4+
import { getMCPServersConfig, isMCPEnabled, validateMCPServerConfig } from '../config/mcp.config';
95
import { MCPServerConfig, MCPConnectionInfo } from '../interfaces/mcp.interface';
106
import { MCPConfigurationException } from '../exceptions/mcp.exceptions';
117

@@ -68,9 +64,7 @@ export class MCPConnectionManagerService implements OnModuleInit {
6864
this.logger.log('MCP Connection Manager initialized successfully');
6965
} catch (error) {
7066
this.logger.error('Failed to initialize MCP Connection Manager', error);
71-
throw new MCPConfigurationException(
72-
error instanceof Error ? error.message : 'Unknown error',
73-
);
67+
throw new MCPConfigurationException(error instanceof Error ? error.message : 'Unknown error');
7468
}
7569
}
7670

@@ -80,9 +74,7 @@ export class MCPConnectionManagerService implements OnModuleInit {
8074
async connectAll(): Promise<void> {
8175
this.logger.log(`Connecting to ${this.serverConfigs.length} MCP servers`);
8276

83-
const connectionPromises = this.serverConfigs.map((config) =>
84-
this.connectWithRetry(config),
85-
);
77+
const connectionPromises = this.serverConfigs.map((config) => this.connectWithRetry(config));
8678

8779
const results = await Promise.allSettled(connectionPromises);
8880

@@ -112,9 +104,7 @@ export class MCPConnectionManagerService implements OnModuleInit {
112104
await this.mcpClient.connect(config);
113105
return; // Success
114106
} catch (error) {
115-
this.logger.warn(
116-
`Connection attempt ${attempt}/${maxAttempts} failed for ${config.name}`,
117-
);
107+
this.logger.warn(`Connection attempt ${attempt}/${maxAttempts} failed for ${config.name}`);
118108

119109
if (attempt === maxAttempts) {
120110
throw error; // All attempts failed

backend/src/modules/mcp/services/mcp-tool-invoker.service.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,7 @@ export class MCPToolInvokerService {
8787

8888
// Stop if any tool fails
8989
if (!result.success) {
90-
this.logger.warn(
91-
`Tool ${request.toolName} failed, stopping sequential execution`,
92-
);
90+
this.logger.warn(`Tool ${request.toolName} failed, stopping sequential execution`);
9391
break;
9492
}
9593
}
@@ -129,10 +127,7 @@ export class MCPToolInvokerService {
129127
if (schema.required) {
130128
for (const requiredParam of schema.required) {
131129
if (!(requiredParam in parameters)) {
132-
throw new MCPToolException(
133-
tool.name,
134-
`Missing required parameter: ${requiredParam}`,
135-
);
130+
throw new MCPToolException(tool.name, `Missing required parameter: ${requiredParam}`);
136131
}
137132
}
138133
}
@@ -152,7 +147,10 @@ export class MCPToolInvokerService {
152147
const actualType = Array.isArray(paramValue) ? 'array' : typeof paramValue;
153148
const expectedType = paramSchema.type;
154149

155-
if (actualType !== expectedType && !(actualType === 'object' && expectedType === 'object')) {
150+
if (
151+
actualType !== expectedType &&
152+
!(actualType === 'object' && expectedType === 'object')
153+
) {
156154
throw new MCPToolException(
157155
tool.name,
158156
`Invalid type for parameter '${paramName}': expected ${expectedType}, got ${actualType}`,

0 commit comments

Comments
 (0)