Skip to content

Commit dc83711

Browse files
authored
fix(memory): rename MCP tool names to comply with strict client naming regex (#59)
MCP clients like Antigravity enforce the tool-name pattern ^[a-zA-Z0-9_-]{1,64}$, which rejects the existing memory.storeKnowledge, memory.updateKnowledge, and memory.searchKnowledge tool names because of the dot separator. Rename to memory_storeKnowledge, memory_updateKnowledge, memory_searchKnowledge so the server is loadable across all MCP clients. To keep existing users on older init templates from breaking, the CallTool dispatcher also accepts the deprecated dotted names as backward-compat aliases. The aliases can be removed in the next major. Exports the TOOLS array and adds a unit test that asserts every registered tool name satisfies the MCP naming regex, guarding against future regressions when new tools are added. Updates README examples and all per-agent remember command templates (Claude, Cursor, Codex, Gemini, Antigravity, GitHub Copilot, generic agent workflows) to reference the new names. Historical design docs under docs/ai/ are intentionally left unchanged as frozen records. Fixes #40
1 parent a919c47 commit dc83711

File tree

11 files changed

+42
-16
lines changed

11 files changed

+42
-16
lines changed

.agent/workflows/remember.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Help me store it in the knowledge memory service.
77
1. **Capture Knowledge** — If not already provided, ask for: a short explicit title (5-12 words), detailed content (markdown, examples encouraged), optional tags (keywords like "api", "testing"), and optional scope (`global`, `project:<name>`, `repo:<name>`). If vague, ask follow-ups to make it specific and actionable.
88
2. **Search Before Store** — Check for existing similar entries first with `npx ai-devkit@latest memory search --query "<topic>"` to avoid duplicates.
99
3. **Validate Quality** — Ensure it is specific and reusable (not generic advice). Avoid storing secrets or sensitive data.
10-
4. **Store** — Call `memory.storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
10+
4. **Store** — Call `memory_storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
1111
5. **Confirm** — Summarize what was saved and offer to retrieve related memory entries when helpful.
1212
6. **Next Command Guidance** — Continue with the current lifecycle phase command (`/execute-plan`, `/check-implementation`, `/writing-test`, etc.) as needed.

.claude/commands/remember.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Help me store it in the knowledge memory service.
77
1. **Capture Knowledge** — If not already provided, ask for: a short explicit title (5-12 words), detailed content (markdown, examples encouraged), optional tags (keywords like "api", "testing"), and optional scope (`global`, `project:<name>`, `repo:<name>`). If vague, ask follow-ups to make it specific and actionable.
88
2. **Search Before Store** — Check for existing similar entries first with `npx ai-devkit@latest memory search --query "<topic>"` to avoid duplicates.
99
3. **Validate Quality** — Ensure it is specific and reusable (not generic advice). Avoid storing secrets or sensitive data.
10-
4. **Store** — Call `memory.storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
10+
4. **Store** — Call `memory_storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
1111
5. **Confirm** — Summarize what was saved and offer to retrieve related memory entries when helpful.
1212
6. **Next Command Guidance** — Continue with the current lifecycle phase command (`/execute-plan`, `/check-implementation`, `/writing-test`, etc.) as needed.

.codex/commands/remember.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Help me store it in the knowledge memory service.
77
1. **Capture Knowledge** — If not already provided, ask for: a short explicit title (5-12 words), detailed content (markdown, examples encouraged), optional tags (keywords like "api", "testing"), and optional scope (`global`, `project:<name>`, `repo:<name>`). If vague, ask follow-ups to make it specific and actionable.
88
2. **Search Before Store** — Check for existing similar entries first with `npx ai-devkit@latest memory search --query "<topic>"` to avoid duplicates.
99
3. **Validate Quality** — Ensure it is specific and reusable (not generic advice). Avoid storing secrets or sensitive data.
10-
4. **Store** — Call `memory.storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
10+
4. **Store** — Call `memory_storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
1111
5. **Confirm** — Summarize what was saved and offer to retrieve related memory entries when helpful.
1212
6. **Next Command Guidance** — Continue with the current lifecycle phase command (`/execute-plan`, `/check-implementation`, `/writing-test`, etc.) as needed.

.cursor/commands/remember.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Help me store it in the knowledge memory service.
77
1. **Capture Knowledge** — If not already provided, ask for: a short explicit title (5-12 words), detailed content (markdown, examples encouraged), optional tags (keywords like "api", "testing"), and optional scope (`global`, `project:<name>`, `repo:<name>`). If vague, ask follow-ups to make it specific and actionable.
88
2. **Search Before Store** — Check for existing similar entries first with `npx ai-devkit@latest memory search --query "<topic>"` to avoid duplicates.
99
3. **Validate Quality** — Ensure it is specific and reusable (not generic advice). Avoid storing secrets or sensitive data.
10-
4. **Store** — Call `memory.storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
10+
4. **Store** — Call `memory_storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
1111
5. **Confirm** — Summarize what was saved and offer to retrieve related memory entries when helpful.
1212
6. **Next Command Guidance** — Continue with the current lifecycle phase command (`/execute-plan`, `/check-implementation`, `/writing-test`, etc.) as needed.

.gemini/commands/remember.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ prompt='''Help me store it in the knowledge memory service.
44
1. **Capture Knowledge** — If not already provided, ask for: a short explicit title (5-12 words), detailed content (markdown, examples encouraged), optional tags (keywords like "api", "testing"), and optional scope (`global`, `project:<name>`, `repo:<name>`). If vague, ask follow-ups to make it specific and actionable.
55
2. **Search Before Store** — Check for existing similar entries first with `npx ai-devkit@latest memory search --query "<topic>"` to avoid duplicates.
66
3. **Validate Quality** — Ensure it is specific and reusable (not generic advice). Avoid storing secrets or sensitive data.
7-
4. **Store** — Call `memory.storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
7+
4. **Store** — Call `memory_storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
88
5. **Confirm** — Summarize what was saved and offer to retrieve related memory entries when helpful.
99
6. **Next Command Guidance** — Continue with the current lifecycle phase command (`/execute-plan`, `/check-implementation`, `/writing-test`, etc.) as needed.'''

.github/prompts/remember.prompt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Help me store it in the knowledge memory service.
77
1. **Capture Knowledge** — If not already provided, ask for: a short explicit title (5-12 words), detailed content (markdown, examples encouraged), optional tags (keywords like "api", "testing"), and optional scope (`global`, `project:<name>`, `repo:<name>`). If vague, ask follow-ups to make it specific and actionable.
88
2. **Search Before Store** — Check for existing similar entries first with `npx ai-devkit@latest memory search --query "<topic>"` to avoid duplicates.
99
3. **Validate Quality** — Ensure it is specific and reusable (not generic advice). Avoid storing secrets or sensitive data.
10-
4. **Store** — Call `memory.storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
10+
4. **Store** — Call `memory_storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
1111
5. **Confirm** — Summarize what was saved and offer to retrieve related memory entries when helpful.
1212
6. **Next Command Guidance** — Continue with the current lifecycle phase command (`/execute-plan`, `/check-implementation`, `/writing-test`, etc.) as needed.

commands/remember.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Help me store it in the knowledge memory service.
77
1. **Capture Knowledge** — If not already provided, ask for: a short explicit title (5-12 words), detailed content (markdown, examples encouraged), optional tags (keywords like "api", "testing"), and optional scope (`global`, `project:<name>`, `repo:<name>`). If vague, ask follow-ups to make it specific and actionable.
88
2. **Search Before Store** — Check for existing similar entries first with `npx ai-devkit@latest memory search --query "<topic>"` to avoid duplicates.
99
3. **Validate Quality** — Ensure it is specific and reusable (not generic advice). Avoid storing secrets or sensitive data.
10-
4. **Store** — Call `memory.storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
10+
4. **Store** — Call `memory_storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
1111
5. **Confirm** — Summarize what was saved and offer to retrieve related memory entries when helpful.
1212
6. **Next Command Guidance** — Continue with the current lifecycle phase command (`/execute-plan`, `/check-implementation`, `/writing-test`, etc.) as needed.

packages/cli/templates/commands/remember.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ Help me store it in the knowledge memory service.
77
1. **Capture Knowledge** — If not already provided, ask for: a short explicit title (5-12 words), detailed content (markdown, examples encouraged), optional tags (keywords like "api", "testing"), and optional scope (`global`, `project:<name>`, `repo:<name>`). If vague, ask follow-ups to make it specific and actionable.
88
2. **Search Before Store** — Check for existing similar entries first with `npx ai-devkit@latest memory search --query "<topic>"` to avoid duplicates.
99
3. **Validate Quality** — Ensure it is specific and reusable (not generic advice). Avoid storing secrets or sensitive data.
10-
4. **Store** — Call `memory.storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
10+
4. **Store** — Call `memory_storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit@latest memory store` instead.
1111
5. **Confirm** — Summarize what was saved and offer to retrieve related memory entries when helpful.
1212
6. **Next Command Guidance** — Continue with the current lifecycle phase command (`/execute-plan`, `/check-implementation`, `/writing-test`, etc.) as needed.

packages/memory/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Add to your MCP client configuration (e.g., Claude Code, Cursor):
3838

3939
```json
4040
{
41-
"tool": "memory.storeKnowledge",
41+
"tool": "memory_storeKnowledge",
4242
"arguments": {
4343
"title": "Always use Response DTOs for API endpoints",
4444
"content": "When building REST APIs, always use Response DTOs instead of returning domain entities directly.",
@@ -52,7 +52,7 @@ Add to your MCP client configuration (e.g., Claude Code, Cursor):
5252

5353
```json
5454
{
55-
"tool": "memory.searchKnowledge",
55+
"tool": "memory_searchKnowledge",
5656
"arguments": {
5757
"query": "building an API endpoint",
5858
"contextTags": ["api"],

packages/memory/src/server.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const SERVER_NAME = 'ai-devkit-memory';
1414
const SERVER_VERSION = '0.1.0';
1515

1616
const STORE_TOOL = {
17-
name: 'memory.storeKnowledge',
17+
name: 'memory_storeKnowledge',
1818
description: 'Store a new knowledge item. Use this to save actionable guidelines, rules, or patterns for future reference.',
1919
inputSchema: {
2020
type: 'object' as const,
@@ -42,7 +42,7 @@ const STORE_TOOL = {
4242
};
4343

4444
const UPDATE_TOOL = {
45-
name: 'memory.updateKnowledge',
45+
name: 'memory_updateKnowledge',
4646
description: 'Update an existing knowledge item by ID. Use this to correct outdated or inaccurate knowledge.',
4747
inputSchema: {
4848
type: 'object' as const,
@@ -74,7 +74,7 @@ const UPDATE_TOOL = {
7474
};
7575

7676
const SEARCH_TOOL = {
77-
name: 'memory.searchKnowledge',
77+
name: 'memory_searchKnowledge',
7878
description: 'Search for relevant knowledge based on a task description. Returns ranked results.',
7979
inputSchema: {
8080
type: 'object' as const,
@@ -101,6 +101,8 @@ const SEARCH_TOOL = {
101101
},
102102
};
103103

104+
export const TOOLS = [STORE_TOOL, UPDATE_TOOL, SEARCH_TOOL];
105+
104106
export function createServer(): Server {
105107
const server = new Server(
106108
{
@@ -126,7 +128,9 @@ export function createServer(): Server {
126128
const { name, arguments: args } = request.params;
127129

128130
try {
129-
if (name === 'memory.storeKnowledge') {
131+
// Backward-compat: accept deprecated dotted names so agents with
132+
// stale prompts/templates continue to work. Remove in next major.
133+
if (name === 'memory_storeKnowledge' || name === 'memory.storeKnowledge') {
130134
const input = args as unknown as StoreKnowledgeInput;
131135
const result = storeKnowledge(input);
132136
return {
@@ -139,7 +143,7 @@ export function createServer(): Server {
139143
};
140144
}
141145

142-
if (name === 'memory.updateKnowledge') {
146+
if (name === 'memory_updateKnowledge' || name === 'memory.updateKnowledge') {
143147
const input = args as unknown as UpdateKnowledgeInput;
144148
const result = updateKnowledge(input);
145149
return {
@@ -152,7 +156,7 @@ export function createServer(): Server {
152156
};
153157
}
154158

155-
if (name === 'memory.searchKnowledge') {
159+
if (name === 'memory_searchKnowledge' || name === 'memory.searchKnowledge') {
156160
const input = args as unknown as SearchKnowledgeInput;
157161
const result = searchKnowledge(input);
158162
return {

0 commit comments

Comments
 (0)