diff options
| author | Fuwn <[email protected]> | 2026-02-03 21:32:11 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-03 21:32:11 -0800 |
| commit | d01c2512aca7a7e08e7172de568bbd1ea7220501 (patch) | |
| tree | 33771c936b06818821440d142f1d813d14b3db97 /packages | |
| parent | refactor(sdk): Use self-documenting variable names (diff) | |
| download | archived-imemio-d01c2512aca7a7e08e7172de568bbd1ea7220501.tar.xz archived-imemio-d01c2512aca7a7e08e7172de568bbd1ea7220501.zip | |
refactor(mcp): Use self-documenting variable names
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/mcp/src/index.ts | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/packages/mcp/src/index.ts b/packages/mcp/src/index.ts index 9102c62..46aa487 100644 --- a/packages/mcp/src/index.ts +++ b/packages/mcp/src/index.ts @@ -14,13 +14,13 @@ import { } from "@imemio/sdk"; function getRequiredEnvironmentVariable(name: string): string { - const value = process.env[name]; + const environmentVariableValue = process.env[name]; - if (!value) { + if (!environmentVariableValue) { throw new Error(`Missing required environment variable: ${name}`); } - return value; + return environmentVariableValue; } function getOptionalEnvironmentVariable(name: string): string | undefined { @@ -99,9 +99,9 @@ server.tool( id: z.string().describe("The memory ID"), }, async (parameters) => { - const result = await memoryStore.read(parameters.id); + const memoryReadResult = await memoryStore.read(parameters.id); - if (!result.success) { + if (!memoryReadResult.success) { return { content: [ { @@ -117,7 +117,7 @@ server.tool( content: [ { type: "text" as const, - text: JSON.stringify(result.value, null, 2), + text: JSON.stringify(memoryReadResult.value, null, 2), }, ], }; @@ -134,14 +134,14 @@ server.tool( metadata: metadataSchema.optional().describe("New metadata"), }, async (parameters) => { - const result = await memoryStore.update(parameters.id, { + const memoryUpdateResult = await memoryStore.update(parameters.id, { content: parameters.content, folderId: parameters.folderId, tags: parameters.tags, metadata: parameters.metadata, }); - if (!result.success) { + if (!memoryUpdateResult.success) { return { content: [ { @@ -157,7 +157,7 @@ server.tool( content: [ { type: "text" as const, - text: JSON.stringify(result.value, null, 2), + text: JSON.stringify(memoryUpdateResult.value, null, 2), }, ], }; @@ -170,9 +170,9 @@ server.tool( id: z.string().describe("The memory ID to delete"), }, async (parameters) => { - const result = await memoryStore.delete(parameters.id); + const memoryDeleteResult = await memoryStore.delete(parameters.id); - if (!result.success) { + if (!memoryDeleteResult.success) { return { content: [ { @@ -255,9 +255,9 @@ server.tool( id: z.string().describe("The project ID"), }, async (parameters) => { - const result = await projectStore.get(parameters.id); + const projectReadResult = await projectStore.get(parameters.id); - if (!result.success) { + if (!projectReadResult.success) { return { content: [ { @@ -273,7 +273,7 @@ server.tool( content: [ { type: "text" as const, - text: JSON.stringify(result.value, null, 2), + text: JSON.stringify(projectReadResult.value, null, 2), }, ], }; @@ -289,13 +289,13 @@ server.tool( isGlobal: z.boolean().optional().describe("New global status"), }, async (parameters) => { - const result = await projectStore.update(parameters.id, { + const projectUpdateResult = await projectStore.update(parameters.id, { name: parameters.name, description: parameters.description, isGlobal: parameters.isGlobal, }); - if (!result.success) { + if (!projectUpdateResult.success) { return { content: [ { @@ -311,7 +311,7 @@ server.tool( content: [ { type: "text" as const, - text: JSON.stringify(result.value, null, 2), + text: JSON.stringify(projectUpdateResult.value, null, 2), }, ], }; @@ -324,9 +324,9 @@ server.tool( id: z.string().describe("The project ID to delete"), }, async (parameters) => { - const result = await projectStore.delete(parameters.id); + const projectDeleteResult = await projectStore.delete(parameters.id); - if (!result.success) { + if (!projectDeleteResult.success) { return { content: [ { @@ -406,7 +406,7 @@ server.tool( description: z.string().nullable().optional().describe("New description"), }, async (parameters) => { - const result = await projectStore.updateFolder( + const folderUpdateResult = await projectStore.updateFolder( parameters.projectId, parameters.folderId, { @@ -415,8 +415,8 @@ server.tool( }, ); - if (!result.success) { - const errorType = result.error.type; + if (!folderUpdateResult.success) { + const errorType = folderUpdateResult.error.type; if (errorType === "PROJECT_NOT_FOUND") { return { @@ -445,7 +445,7 @@ server.tool( content: [ { type: "text" as const, - text: JSON.stringify(result.value, null, 2), + text: JSON.stringify(folderUpdateResult.value, null, 2), }, ], }; @@ -459,13 +459,13 @@ server.tool( folderId: z.string().describe("The folder ID to remove"), }, async (parameters) => { - const result = await projectStore.removeFolder( + const folderRemoveResult = await projectStore.removeFolder( parameters.projectId, parameters.folderId, ); - if (!result.success) { - const errorType = result.error.type; + if (!folderRemoveResult.success) { + const errorType = folderRemoveResult.error.type; if (errorType === "PROJECT_NOT_FOUND") { return { |