sciverse-mcp-server 0.11.0 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- export declare const TOOLS_VERSION = "0.11.0";
1
+ export declare const TOOLS_VERSION = "0.11.2";
2
2
  export interface ToolDef {
3
3
  name: string;
4
4
  description: string;
@@ -1,6 +1,6 @@
1
1
  // Auto-generated by scripts/gen-tools.mjs. Do not edit.
2
2
  // Source of truth: openapi.yaml
3
- export const TOOLS_VERSION = "0.11.0";
3
+ export const TOOLS_VERSION = "0.11.2";
4
4
  export const TOOLS = [
5
5
  {
6
6
  "name": "search_papers",
@@ -171,7 +171,8 @@ export const TOOLS = [
171
171
  "type": "integer",
172
172
  "default": 10,
173
173
  "minimum": 1,
174
- "maximum": 30
174
+ "maximum": 100,
175
+ "description": "返回命中条数上限,合法 1-100(服务端校验,超出报 400)。\n实际条数还受 mode 影响:balanced 单路混合召回在服务端固定截到约 50 条,\ntop_k 超过 50 时多出的部分不会返回;fast 与 quality 可取到 top_k。\n另外同一篇论文最多返回约 3 个 chunk,因此高 top_k 需要命中足够多的不同论文。\n"
175
176
  },
176
177
  "source_types": {
177
178
  "type": "array",
package/dist/tools.js CHANGED
@@ -58,6 +58,25 @@ function toBackendPayload(args) {
58
58
  out.sort = sort;
59
59
  return out;
60
60
  }
61
+ // 上游 agentic-search(Go 服务)没有 mode 字段,未知字段会被静默丢弃,
62
+ // 所以 mode 必须在这里翻译为上游真实参数 retrieval / sub_queries。
63
+ // 与 packages/typescript/src/client.ts 的 SEMANTIC_MODE_MAP 保持一致(同 toBackendPayload 的复制约定)。
64
+ const SEMANTIC_MODE_MAP = {
65
+ fast: { retrieval: "es" },
66
+ balanced: { retrieval: "hybrid" },
67
+ quality: { retrieval: "hybrid", sub_queries: 3 },
68
+ };
69
+ function toSemanticSearchPayload(args) {
70
+ const { mode, ...rest } = args;
71
+ if (mode === undefined || mode === null)
72
+ return rest;
73
+ const mapped = SEMANTIC_MODE_MAP[mode];
74
+ if (!mapped) {
75
+ throw new Error(`mode must be one of ${Object.keys(SEMANTIC_MODE_MAP).join(" / ")}, got ${JSON.stringify(mode)}`);
76
+ }
77
+ // 显式传入的 retrieval / sub_queries 优先于 mode 映射。
78
+ return { ...mapped, ...rest };
79
+ }
61
80
  const PLATFORM = process.platform;
62
81
  async function call(config, method, path, options = {}) {
63
82
  const url = new URL(`${config.baseUrl}${path}`);
@@ -152,8 +171,19 @@ export async function executeTool(config, name, args) {
152
171
  switch (name) {
153
172
  case "search_papers":
154
173
  return call(config, "POST", endpoint.path, { body: toBackendPayload(args) });
155
- case "semantic_search":
156
- return call(config, "POST", endpoint.path, { body: args });
174
+ case "semantic_search": {
175
+ let body;
176
+ try {
177
+ body = toSemanticSearchPayload(args);
178
+ }
179
+ catch (e) {
180
+ return {
181
+ isError: true,
182
+ content: [{ type: "text", text: JSON.stringify({ error: e.message }) }],
183
+ };
184
+ }
185
+ return call(config, "POST", endpoint.path, { body });
186
+ }
157
187
  case "list_catalog": {
158
188
  const { include_sample_values, include_field_stats, collection } = args;
159
189
  const query = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sciverse-mcp-server",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Sciverse MCP server — exposes academic paper retrieval (search_papers / semantic_search / read_content) to MCP-compatible coding agents (Claude Code, Cursor, Codex CLI, Windsurf, ...).",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/opendatalab/Sciverse-Agent-Tools/tree/main/packages/mcp",