Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(mcp): allow recent chat searches without arguments

Louis Beaumont2fcbdb6e3682
diff --git a/packages/screenpipe-mcp/src/chat-search-transport.test.ts b/packages/screenpipe-mcp/src/chat-search-transport.test.ts
index 8b450b5ed..3a2e9447d 100644
--- a/packages/screenpipe-mcp/src/chat-search-transport.test.ts
+++ b/packages/screenpipe-mcp/src/chat-search-transport.test.ts
@@ -44,6 +44,10 @@ it.each(["stdio", "http"])("discovers and calls read-only chat search through %s
const search = requests.find(req => req.url === "/chats/search")!;
expect(search.auth).toBe("Bearer fixture-key");
expect(JSON.parse(search.body)).toEqual({ query: "decision", sources: ["claude"], limit: 3 });
+ const recent = await client.callTool({ name: "search-chats" });
+ expect(recent.isError).not.toBe(true);
+ const latest = requests.filter(req => req.url === "/chats/search").at(-1)!;
+ expect(JSON.parse(latest.body)).toEqual({ query: "", sources: [], limit: 10 });
status = 404;
// Both transport error envelopes must signal failure, never an empty history.
try {
diff --git a/packages/screenpipe-mcp/src/http-server.ts b/packages/screenpipe-mcp/src/http-server.ts
index 2607d2172..4f3842797 100644
--- a/packages/screenpipe-mcp/src/http-server.ts
+++ b/packages/screenpipe-mcp/src/http-server.ts
@@ -324,7 +324,8 @@ function createMcpServer(screenpipePort: number): Server {
},
});
s.setRequestHandler(CallToolRequestSchema, async (request) => observeCall(request.params.name, async () => {
- const { name, arguments: args } = request.params;
+ const { name, arguments: suppliedArgs } = request.params;
+ const args = suppliedArgs ?? (name === CHAT_SEARCH_TOOL.name ? {} : undefined);
if (name === BUNDLED_SKILLS_TOOL.name) return readBundledSkills(args);
if (!args) throw Object.assign(new Error("Missing arguments"), { status: 400 });
if (name === CHAT_SEARCH_TOOL.name) return searchChats(args, fetchAPI);
diff --git a/packages/screenpipe-mcp/src/index.ts b/packages/screenpipe-mcp/src/index.ts
index 94a63afce..c47e073ae 100644
--- a/packages/screenpipe-mcp/src/index.ts
+++ b/packages/screenpipe-mcp/src/index.ts
@@ -1416,7 +1416,8 @@ const observeCall = createCallObserver({
send: (payload, signal) => callAPI("/internal/telemetry/mcp-call", { method: "POST", body: JSON.stringify(payload), signal }),
});
server.setRequestHandler(CallToolRequestSchema, async (request) => observeCall(request.params.name, async () => {
- const { name, arguments: args } = request.params;
+ const { name, arguments: suppliedArgs } = request.params;
+ const args = suppliedArgs ?? (name === CHAT_SEARCH_TOOL.name ? {} : undefined);
if (name === BUNDLED_SKILLS_TOOL.name) return readBundledSkills(args);