@codacy/codacy-mcp 0.4.7 → 0.4.9
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 +1 -0
- package/dist/index.js +4 -0
- package/dist/src/handlers/repository.js +4 -0
- package/dist/src/schemas.js +1 -0
- package/dist/src/tools/getFileClonesTool.js +29 -0
- package/dist/src/tools/getFileWithAnalysisTool.js +15 -1
- package/dist/src/tools/getPatternTool.js +10 -1
- package/dist/src/tools/getRepositoryPullRequestFilesCoverageTool.js +11 -1
- package/dist/src/tools/index.js +1 -0
- package/dist/src/tools/listFileIssuesTool.js +1 -0
- package/package.json +1 -1
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);
|
package/dist/src/schemas.js
CHANGED
|
@@ -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
|
+
};
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
import { generalOrganizationMistakes, generalRepositoryMistakes } from '../rules.js';
|
|
1
2
|
import { fileSchema, toolNames } from '../schemas.js';
|
|
3
|
+
import { listFilesTool } from './listFilesTool.js';
|
|
4
|
+
const rules = `
|
|
5
|
+
If a file is ignored, it is not analyzed by Codacy.
|
|
6
|
+
Using this tool you'll get results for five metrics: Grade, Issues, Duplication, Complexity and Coverage.
|
|
7
|
+
|
|
8
|
+
Common use cases:
|
|
9
|
+
- When the user asks for the analysis results of a specific file.
|
|
10
|
+
|
|
11
|
+
Common mistakes:
|
|
12
|
+
- Using this tool with the wrong fileId. You can get the fileId by using the ${listFilesTool.name} tool with this file name as the search parameter.
|
|
13
|
+
${generalOrganizationMistakes}
|
|
14
|
+
${generalRepositoryMistakes}
|
|
15
|
+
`;
|
|
2
16
|
export const getFileWithAnalysisTool = {
|
|
3
17
|
name: toolNames.CODACY_GET_FILE_WITH_ANALYSIS,
|
|
4
|
-
description:
|
|
18
|
+
description: `Use this tool to get information for a file and it's analysis information and coverage metrics. \n ${rules}`,
|
|
5
19
|
inputSchema: {
|
|
6
20
|
type: 'object',
|
|
7
21
|
properties: {
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { toolNames } from '../schemas.js';
|
|
2
|
+
const rules = `
|
|
3
|
+
Common use cases:
|
|
4
|
+
- When the user asks for the definition of a specific pattern
|
|
5
|
+
- When the user asks for more information about an issue found by Codacy
|
|
6
|
+
|
|
7
|
+
Common mistakes:
|
|
8
|
+
- Using this tool with the wrong toolUuid
|
|
9
|
+
- Using this tool with the wrong patternId
|
|
10
|
+
`;
|
|
2
11
|
export const getPatternTool = {
|
|
3
12
|
name: toolNames.CODACY_GET_PATTERN,
|
|
4
|
-
description:
|
|
13
|
+
description: `Get the definition of a specific pattern. \n ${rules}`,
|
|
5
14
|
inputSchema: {
|
|
6
15
|
type: 'object',
|
|
7
16
|
properties: {
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
import { generalOrganizationMistakes, generalRepositoryMistakes } from '../rules.js';
|
|
1
2
|
import { repositorySchema, toolNames } from '../schemas.js';
|
|
3
|
+
const rules = `
|
|
4
|
+
Common use cases:
|
|
5
|
+
- When the user asks for the coverage of the files in a specific pull request
|
|
6
|
+
|
|
7
|
+
Common mistakes:
|
|
8
|
+
- Using this tool for a specific file. For specific file coverage, use the ${toolNames.CODACY_GET_FILE_WITH_ANALYSIS} tool instead.
|
|
9
|
+
${generalOrganizationMistakes}
|
|
10
|
+
${generalRepositoryMistakes}
|
|
11
|
+
`;
|
|
2
12
|
export const getRepositoryPullRequestFilesCoverageTool = {
|
|
3
13
|
name: toolNames.CODACY_GET_REPOSITORY_PULL_REQUEST_FILES_COVERAGE,
|
|
4
|
-
description:
|
|
14
|
+
description: `Use this tool to get coverage information for all files in a pull request. \n ${rules}`,
|
|
5
15
|
inputSchema: {
|
|
6
16
|
type: 'object',
|
|
7
17
|
properties: {
|
package/dist/src/tools/index.js
CHANGED
|
@@ -7,6 +7,7 @@ const rules = `
|
|
|
7
7
|
Common use cases:
|
|
8
8
|
- When the user asks for the issues for a specific file
|
|
9
9
|
- When the user is in a file context and asks for the issues
|
|
10
|
+
- When the user asks if a specific file has issues
|
|
10
11
|
|
|
11
12
|
Common mistakes:
|
|
12
13
|
- Using this tool for listing the issues for specific pull requests
|