Skip to content

Commit f4ef924

Browse files
add isIdempotent
1 parent 7f38753 commit f4ef924

File tree

9 files changed

+9
-0
lines changed

9 files changed

+9
-0
lines changed

packages/web/src/features/tools/adapters.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export function registerMcpTool<TName extends string, TShape extends z.ZodRawSha
3131
inputSchema: def.inputSchema.shape as z.ZodRawShape,
3232
annotations: {
3333
readOnlyHint: def.isReadOnly,
34+
idempotentHint: def.isIdempotent,
3435
},
3536
},
3637
async (input) => {

packages/web/src/features/tools/findSymbolDefinitions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const findSymbolDefinitionsDefinition: ToolDefinition<
2424
> = {
2525
name: 'find_symbol_definitions',
2626
isReadOnly: true,
27+
isIdempotent: true,
2728
description,
2829
inputSchema: z.object(findSymbolDefinitionsShape),
2930
execute: async ({ symbol, language, repo }, _context) => {

packages/web/src/features/tools/findSymbolReferences.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const findSymbolReferencesDefinition: ToolDefinition<
3131
> = {
3232
name: 'find_symbol_references',
3333
isReadOnly: true,
34+
isIdempotent: true,
3435
description,
3536
inputSchema: z.object(findSymbolReferencesShape),
3637
execute: async ({ symbol, language, repo }, _context) => {

packages/web/src/features/tools/listCommits.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export type ListCommitsMetadata = SearchCommitsResult;
2121
export const listCommitsDefinition: ToolDefinition<"list_commits", typeof listCommitsShape, ListCommitsMetadata> = {
2222
name: "list_commits",
2323
isReadOnly: true,
24+
isIdempotent: true,
2425
description,
2526
inputSchema: z.object(listCommitsShape),
2627
execute: async (params, _context) => {

packages/web/src/features/tools/listRepos.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const listReposDefinition: ToolDefinition<
3434
> = {
3535
name: 'list_repos',
3636
isReadOnly: true,
37+
isIdempotent: true,
3738
description,
3839
inputSchema: z.object(listReposShape),
3940
execute: async ({ page, perPage, sort, direction, query }, context) => {

packages/web/src/features/tools/listTree.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export type ListTreeMetadata = {
4141
export const listTreeDefinition: ToolDefinition<'list_tree', typeof listTreeShape, ListTreeMetadata> = {
4242
name: 'list_tree',
4343
isReadOnly: true,
44+
isIdempotent: true,
4445
description,
4546
inputSchema: z.object(listTreeShape),
4647
execute: async ({ repo, path = '', ref = 'HEAD', depth = DEFAULT_TREE_DEPTH, includeFiles = true, includeDirectories = true, maxEntries = DEFAULT_MAX_TREE_ENTRIES }, context) => {

packages/web/src/features/tools/readFile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export type ReadFileMetadata = {
3636
export const readFileDefinition: ToolDefinition<"read_file", typeof readFileShape, ReadFileMetadata> = {
3737
name: "read_file",
3838
isReadOnly: true,
39+
isIdempotent: true,
3940
description,
4041
inputSchema: z.object(readFileShape),
4142
execute: async ({ path, repo, offset, limit }, context) => {

packages/web/src/features/tools/searchCode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export type SearchCodeMetadata = {
6565
export const searchCodeDefinition: ToolDefinition<'search_code', typeof searchCodeShape, SearchCodeMetadata> = {
6666
name: 'search_code',
6767
isReadOnly: true,
68+
isIdempotent: true,
6869
description,
6970
inputSchema: z.object(searchCodeShape),
7071
execute: async ({

packages/web/src/features/tools/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface ToolDefinition<
1313
description: string;
1414
inputSchema: z.ZodObject<TShape>;
1515
isReadOnly: boolean;
16+
isIdempotent: boolean;
1617
execute: (input: z.infer<z.ZodObject<TShape>>, context: ToolContext) => Promise<ToolResult<TMetadata>>;
1718
}
1819

0 commit comments

Comments
 (0)