@codacy/codacy-mcp 0.4.7 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,6 +35,7 @@ The following tools are available through the Codacy MCP Server:
35
35
  - `codacy_list_files`: List files in a repository with pagination support.
36
36
  - `codacy_get_file_issues`: Get the issue list for a file in a repository.
37
37
  - `codacy_get_file_coverage`: Get coverage information for a file in the head commit of a repository branch.
38
+ - `codacy_get_file_clones`: Get the list of duplication clones (identical or very similar code segments) for a file in a repository. Use this tool to identify potential refactoring opportunities and reduce code duplication.
38
39
 
39
40
  ### Security Analysis
40
41
 
package/dist/index.js CHANGED
@@ -103,6 +103,10 @@ const toolDefinitions = {
103
103
  tool: Tools.getFileWithAnalysisTool,
104
104
  handler: Handlers.getFileWithAnalysisHandler,
105
105
  },
106
+ codacy_get_file_clones: {
107
+ tool: Tools.getFileClonesTool,
108
+ handler: Handlers.getFileClonesHandler,
109
+ },
106
110
  codacy_get_repository_pull_request: {
107
111
  tool: Tools.getRepositoryPullRequestTool,
108
112
  handler: Handlers.getRepositoryPullRequestHandler,
@@ -3,6 +3,10 @@ export const getFileWithAnalysisHandler = async (args) => {
3
3
  const { provider, organization, repository, fileId } = args;
4
4
  return await RepositoryService.getFileWithAnalysis(provider, organization, repository, fileId);
5
5
  };
6
+ export const getFileClonesHandler = async (args) => {
7
+ const { provider, organization, repository, fileId } = args;
8
+ return await RepositoryService.getFileClones(provider, organization, repository, fileId);
9
+ };
6
10
  export const listFilesHandler = async (args) => {
7
11
  const { provider, organization, repository, branch, search, sort, direction, cursor, limit } = args;
8
12
  return await RepositoryService.listFiles(provider, organization, repository, branch, search, sort, direction, cursor, limit);
@@ -20,6 +20,7 @@ export const toolNames = {
20
20
  CODACY_GET_ISSUE: 'codacy_get_issue',
21
21
  CODACY_GET_PATTERN: 'codacy_get_pattern',
22
22
  CODACY_CLI_ANALYZE: 'codacy_cli_analyze',
23
+ CODACY_GET_FILE_CLONES: 'codacy_get_file_clones',
23
24
  };
24
25
  export const organizationSchema = {
25
26
  provider: {
@@ -0,0 +1,29 @@
1
+ import { generalOrganizationMistakes, generalRepositoryMistakes } from '../rules.js';
2
+ import { fileSchema, toolNames } from '../schemas.js';
3
+ const rules = `
4
+ Use this tool to list the duplication clones for specific file in a repository.
5
+ Duplication clones are code segments that are identical or very similar to other segments in the codebase.
6
+
7
+ Common use cases:
8
+ - When the user asks for code duplication in a specific file
9
+ - When the user wants to identify repeated code segments
10
+ - When investigating potential refactoring opportunities
11
+
12
+ Common mistakes:
13
+ - Using this tool for listing general code quality issues
14
+ - Using this tool for listing security issues
15
+ - Using this with a wrong fileId (validate the fileId with the codacy_list_files tool)
16
+ ${generalOrganizationMistakes}
17
+ ${generalRepositoryMistakes}
18
+ `;
19
+ export const getFileClonesTool = {
20
+ name: toolNames.CODACY_GET_FILE_CLONES,
21
+ description: `Get the list of duplication clones for a file in a repository. \n ${rules}`,
22
+ inputSchema: {
23
+ type: 'object',
24
+ properties: {
25
+ ...fileSchema,
26
+ },
27
+ required: ['provider', 'organization', 'repository'],
28
+ },
29
+ };
@@ -18,3 +18,4 @@ export * from './listRepositoryToolsTool.js';
18
18
  export * from './listToolsTool.js';
19
19
  export * from './listOrganizationsTool.js';
20
20
  export * from './cliAnalyzeTool.js';
21
+ export * from './getFileClonesTool.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/codacy-mcp",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "description": "Codacy MCP server",
5
5
  "license": "MIT",
6
6
  "author": "Codacy",