feat(work-packages): add ranked search tool over subject, description, and comments

Registers openproject_search_work_packages (readOnly: true), taking the tool
registry from 18 to 19. searchWorkPackages now unions a precise server-side
subject filter with a broad recency-ordered candidate window, ranks via the
shared search pipeline, and deep-enriches top candidates with description and
comment text. Exact-mode requests skip the broad query entirely.

searchWorkPackages's return type changes from a flat PaginatedResult<WorkPackageSummary>
to WorkPackageSearchPage, nesting the summary under `workPackage` alongside
score, matchedFields, and an optional snippet.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5 committed 2026-09-18 11:23:48 +02:00
1 parent 9dee458b1f
commit 326db0659f
7 files changed
+349 -29

No files matched your search

+4 -3
View File
@@ -5,7 +5,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
import { createServer, SERVER_NAME, SERVER_VERSION } from "../src/server";
describe("MCP Server Factory", () => {
test("creates server and lists all 18 tools via InMemoryTransport", async () => {
test("creates server and lists all 19 tools via InMemoryTransport", async () => {
const config = {
baseUrl: "http://localhost:8080",
apiKey: "test-key",
@@ -21,13 +21,14 @@ describe("MCP Server Factory", () => {
await client.connect(clientTransport);
const toolsResult = await client.listTools();
expect(toolsResult.tools).toHaveLength(18);
expect(toolsResult.tools).toHaveLength(19);
const names = toolsResult.tools.map((t) => t.name);
expect(names).toContain("openproject_list_projects");
expect(names).toContain("openproject_get_project");
expect(names).toContain("openproject_list_work_packages");
expect(names).toContain("openproject_get_work_package");
expect(names).toContain("openproject_list_work_package_activities");
expect(names).toContain("openproject_search_work_packages");
expect(names).toContain("openproject_list_queries");
expect(names).toContain("openproject_get_query");
expect(names).toContain("openproject_list_types");
@@ -143,7 +144,7 @@ describe("MCP Server Factory", () => {
// In read-only mode, only readOnly: true tools should be registered
const toolsResult = await client.listTools();
expect(toolsResult.tools).toHaveLength(18);
expect(toolsResult.tools).toHaveLength(19);
await client.close();
await mcpServer.stop();