Repository navigation
feat(mcp): add sparql_query read tool (Batch B, clean-room) - #191
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
内容
MCP Batch B:新增
sparql_query只读工具(11 个文件 +771/−11)。Batch A 的 9 个工具已在 #171 落地;Batch C(新服务端点)不在本批,未写任何 Java 服务端代码。smartmetadata-mcp/src/sparql.ts:每次调用先取GET /v1/users/loggedInUser;管理员 →POST /v1/rdf/sparql({query, format, inference}),非管理员 →POST /v1/rdf/sparql/agent(仅{query}),metadata.completeness透传;非管理员拒绝用 pin 原文措辞、在 agent 调用之前返回;管理员 format 由响应 Content-Type 解析,warning取自 inference 警告头;queryType仅在响应可区分时才派生;maxBytes 80000(与 Batch A 一致),走共用clampRdfMaxBytes/boundBody。从不调用/v1/rdf/sparql/update。tools.ts(TOOL_NAMES 23→24、SparqlQueryArgs、handler)、server.ts(sparql_query: true入 TOOL_READ_ONLY、zod schema、pin 描述原文转录——测试断言与tools.json一致)、userContext.ts(共用fetchLoggedInUser,fetchUserContext重构其上)。tools.json的 metric 描述已同步(两处描述现与 pin 字节一致);.env.example+README.md说明OM_MCP_READ_ONLY/OM_MCP_DISABLED_TOOLS(取值、默认值、需重启)。依据
复核
REVIEW-W3-MCP-BC.md(MCP Batch B+C:APPROVE + 16 条件;Batch B 相关条件已满足,Batch C 条件按设计不在本批)。ADR:docs/decisions/2026-11-10-mcp-batch-b-sparql-query.md。新残留 R-W3M-3:graph 结果的queryType省略(CONSTRUCT 与 DESCRIBE 从响应无法区分,TS 不做 SPARQL 解析)——关闭它需要服务端给查询类型信号,是 Batch C 的服务端裁决,已记入 ADR。测试
tsc -p tsconfig.json构建 exit 0;提交头上重跑同样 108/108。