mirror of
https://github.com/yamadashy/repomix.git
synced 2025-06-11 00:25:54 +03:00
Merge pull request #537 from yamadashy/devin/1746862382-add-mcp-tool-annotations
Add support for MCP tool annotations
This commit is contained in:
8
package-lock.json
generated
8
package-lock.json
generated
@@ -10,7 +10,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@clack/prompts": "^0.10.1",
|
"@clack/prompts": "^0.10.1",
|
||||||
"@modelcontextprotocol/sdk": "^1.10.1",
|
"@modelcontextprotocol/sdk": "^1.11.0",
|
||||||
"@secretlint/core": "^9.3.1",
|
"@secretlint/core": "^9.3.1",
|
||||||
"@secretlint/secretlint-rule-preset-recommend": "^9.3.1",
|
"@secretlint/secretlint-rule-preset-recommend": "^9.3.1",
|
||||||
"cli-spinners": "^2.9.2",
|
"cli-spinners": "^2.9.2",
|
||||||
@@ -900,9 +900,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@modelcontextprotocol/sdk": {
|
"node_modules/@modelcontextprotocol/sdk": {
|
||||||
"version": "1.10.1",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.10.1.tgz",
|
"resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.11.1.tgz",
|
||||||
"integrity": "sha512-xNYdFdkJqEfIaTVP1gPKoEvluACHZsHZegIoICX8DM1o6Qf3G5u2BQJHmgd0n4YgRPqqK/u1ujQvrgAxxSJT9w==",
|
"integrity": "sha512-9LfmxKTb1v+vUS1/emSk1f5ePmTLkb9Le9AxOB5T0XM59EUumwcS45z05h7aiZx3GI0Bl7mjb3FMEglYj+acuQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"content-type": "^1.0.5",
|
"content-type": "^1.0.5",
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@clack/prompts": "^0.10.1",
|
"@clack/prompts": "^0.10.1",
|
||||||
"@modelcontextprotocol/sdk": "^1.10.1",
|
"@modelcontextprotocol/sdk": "^1.11.0",
|
||||||
"@secretlint/core": "^9.3.1",
|
"@secretlint/core": "^9.3.1",
|
||||||
"@secretlint/secretlint-rule-preset-recommend": "^9.3.1",
|
"@secretlint/secretlint-rule-preset-recommend": "^9.3.1",
|
||||||
"cli-spinners": "^2.9.2",
|
"cli-spinners": "^2.9.2",
|
||||||
|
|||||||
@@ -15,6 +15,13 @@ export const registerFileSystemReadDirectoryTool = (mcpServer: McpServer) => {
|
|||||||
{
|
{
|
||||||
path: z.string().describe('Absolute path to the directory to list'),
|
path: z.string().describe('Absolute path to the directory to list'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Read Directory',
|
||||||
|
readOnlyHint: true,
|
||||||
|
destructiveHint: false,
|
||||||
|
idempotentHint: true,
|
||||||
|
openWorldHint: false,
|
||||||
|
},
|
||||||
async ({ path: directoryPath }): Promise<CallToolResult> => {
|
async ({ path: directoryPath }): Promise<CallToolResult> => {
|
||||||
try {
|
try {
|
||||||
logger.trace(`Listing directory at absolute path: ${directoryPath}`);
|
logger.trace(`Listing directory at absolute path: ${directoryPath}`);
|
||||||
|
|||||||
@@ -17,6 +17,13 @@ export const registerFileSystemReadFileTool = (mcpServer: McpServer) => {
|
|||||||
{
|
{
|
||||||
path: z.string().describe('Absolute path to the file to read'),
|
path: z.string().describe('Absolute path to the file to read'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Read File',
|
||||||
|
readOnlyHint: true,
|
||||||
|
destructiveHint: false,
|
||||||
|
idempotentHint: true,
|
||||||
|
openWorldHint: false,
|
||||||
|
},
|
||||||
async ({ path: filePath }): Promise<CallToolResult> => {
|
async ({ path: filePath }): Promise<CallToolResult> => {
|
||||||
try {
|
try {
|
||||||
logger.trace(`Reading file at absolute path: ${filePath}`);
|
logger.trace(`Reading file at absolute path: ${filePath}`);
|
||||||
|
|||||||
@@ -36,6 +36,13 @@ export const registerPackCodebaseTool = (mcpServer: McpServer) => {
|
|||||||
.default(10)
|
.default(10)
|
||||||
.describe('Number of top files to display in the metrics (default: 10)'),
|
.describe('Number of top files to display in the metrics (default: 10)'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Pack Local Codebase',
|
||||||
|
readOnlyHint: true,
|
||||||
|
destructiveHint: false,
|
||||||
|
idempotentHint: false,
|
||||||
|
openWorldHint: false,
|
||||||
|
},
|
||||||
async ({ directory, compress, includePatterns, ignorePatterns, topFilesLength }): Promise<CallToolResult> => {
|
async ({ directory, compress, includePatterns, ignorePatterns, topFilesLength }): Promise<CallToolResult> => {
|
||||||
let tempDir = '';
|
let tempDir = '';
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,13 @@ export const registerPackRemoteRepositoryTool = (mcpServer: McpServer) => {
|
|||||||
.default(10)
|
.default(10)
|
||||||
.describe('Number of top files to display in the metrics (default: 10)'),
|
.describe('Number of top files to display in the metrics (default: 10)'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Pack Remote Repository',
|
||||||
|
readOnlyHint: true,
|
||||||
|
destructiveHint: false,
|
||||||
|
idempotentHint: false,
|
||||||
|
openWorldHint: true,
|
||||||
|
},
|
||||||
async ({ remote, compress, includePatterns, ignorePatterns, topFilesLength }): Promise<CallToolResult> => {
|
async ({ remote, compress, includePatterns, ignorePatterns, topFilesLength }): Promise<CallToolResult> => {
|
||||||
let tempDir = '';
|
let tempDir = '';
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,13 @@ export const registerReadRepomixOutputTool = (mcpServer: McpServer) => {
|
|||||||
{
|
{
|
||||||
outputId: z.string().describe('ID of the Repomix output file to read'),
|
outputId: z.string().describe('ID of the Repomix output file to read'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Read Repomix Output',
|
||||||
|
readOnlyHint: true,
|
||||||
|
destructiveHint: false,
|
||||||
|
idempotentHint: true,
|
||||||
|
openWorldHint: false,
|
||||||
|
},
|
||||||
async ({ outputId }): Promise<CallToolResult> => {
|
async ({ outputId }): Promise<CallToolResult> => {
|
||||||
try {
|
try {
|
||||||
logger.trace(`Reading Repomix output with ID: ${outputId}`);
|
logger.trace(`Reading Repomix output with ID: ${outputId}`);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ describe('FileSystemReadDirectoryTool', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.resetAllMocks();
|
vi.resetAllMocks();
|
||||||
registerFileSystemReadDirectoryTool(mockServer);
|
registerFileSystemReadDirectoryTool(mockServer);
|
||||||
toolHandler = (mockServer.tool as ReturnType<typeof vi.fn>).mock.calls[0][3];
|
toolHandler = (mockServer.tool as ReturnType<typeof vi.fn>).mock.calls[0][4];
|
||||||
|
|
||||||
// デフォルトのpath.isAbsoluteの動作をモック
|
// デフォルトのpath.isAbsoluteの動作をモック
|
||||||
vi.mocked(path.isAbsolute).mockImplementation((p: string) => p.startsWith('/'));
|
vi.mocked(path.isAbsolute).mockImplementation((p: string) => p.startsWith('/'));
|
||||||
@@ -32,6 +32,7 @@ describe('FileSystemReadDirectoryTool', () => {
|
|||||||
'file_system_read_directory',
|
'file_system_read_directory',
|
||||||
'List contents of a directory using an absolute path.',
|
'List contents of a directory using an absolute path.',
|
||||||
expect.any(Object),
|
expect.any(Object),
|
||||||
|
expect.any(Object), // annotations
|
||||||
expect.any(Function),
|
expect.any(Function),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ describe('FileSystemReadFileTool', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.resetAllMocks();
|
vi.resetAllMocks();
|
||||||
registerFileSystemReadFileTool(mockServer);
|
registerFileSystemReadFileTool(mockServer);
|
||||||
toolHandler = (mockServer.tool as ReturnType<typeof vi.fn>).mock.calls[0][3];
|
toolHandler = (mockServer.tool as ReturnType<typeof vi.fn>).mock.calls[0][4];
|
||||||
|
|
||||||
// デフォルトのpath.isAbsoluteの動作をモック
|
// デフォルトのpath.isAbsoluteの動作をモック
|
||||||
vi.mocked(path.isAbsolute).mockImplementation((p: string) => p.startsWith('/'));
|
vi.mocked(path.isAbsolute).mockImplementation((p: string) => p.startsWith('/'));
|
||||||
@@ -34,6 +34,7 @@ describe('FileSystemReadFileTool', () => {
|
|||||||
'file_system_read_file',
|
'file_system_read_file',
|
||||||
'Read a file using an absolute path with security validation.',
|
'Read a file using an absolute path with security validation.',
|
||||||
expect.any(Object),
|
expect.any(Object),
|
||||||
|
expect.any(Object), // annotations
|
||||||
expect.any(Function),
|
expect.any(Function),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ describe('PackCodebaseTool', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.resetAllMocks();
|
vi.resetAllMocks();
|
||||||
registerPackCodebaseTool(mockServer);
|
registerPackCodebaseTool(mockServer);
|
||||||
toolHandler = (mockServer.tool as ReturnType<typeof vi.fn>).mock.calls[0][3];
|
toolHandler = (mockServer.tool as ReturnType<typeof vi.fn>).mock.calls[0][4];
|
||||||
|
|
||||||
// デフォルトのパスの動作をモック
|
// デフォルトのパスの動作をモック
|
||||||
vi.mocked(path.join).mockImplementation((...args) => args.join('/'));
|
vi.mocked(path.join).mockImplementation((...args) => args.join('/'));
|
||||||
@@ -102,6 +102,7 @@ describe('PackCodebaseTool', () => {
|
|||||||
'pack_codebase',
|
'pack_codebase',
|
||||||
'Package local code directory into a consolidated file for AI analysis',
|
'Package local code directory into a consolidated file for AI analysis',
|
||||||
expect.any(Object),
|
expect.any(Object),
|
||||||
|
expect.any(Object), // annotations
|
||||||
expect.any(Function),
|
expect.any(Function),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user