Skip to content

Commit 076f096

Browse files
committed
chore(mcp): remove ENABLE_OOXML_TOOLS feature flag
The flag existed so the new structural tools could land without affecting api.ooxml.dev/mcp's surface until prod was ready. The operational plan is to populate the prod schema graph before merging, at which point the flag is just friction. Drops: - ENABLE_OOXML_TOOLS env var on Env / OoxmlEnv - ooxmlToolsEnabled() and the gating in tools/list and tools/call - The defensive 'method-not-found while flag is off' branch Both tools/list and tools/call now expose the OOXML tools unconditionally. Worker bundle builds clean; 44 / 0 tests still pass. Note: prod populate must run before this merges. The current per-row INSERT pattern is slow against Neon over public internet (~10-20 minutes for the WML closure); batching is the next step operationally.
1 parent 99ec4eb commit 076f096

4 files changed

Lines changed: 11 additions & 41 deletions

File tree

CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ The XML you provide is wrapped in a minimal `w:document > w:body` structure auto
105105

106106
## MCP Server
107107

108-
Cloudflare Worker exposing two flavors of MCP tools backed by the same database:
108+
Cloudflare Worker exposing two flavors of MCP tools backed by the same database.
109109

110-
Always-on (semantic search over the spec PDF):
110+
Semantic search over the spec PDF (powered by `spec_content`):
111111

112112
- `search_ecma_spec` - semantic vector search across 18,000+ spec chunks
113113
- `get_section` - fetch a specific section by ID (e.g., "17.3.1.24")
114114
- `list_parts` - browse the spec structure
115115

116-
Behind `ENABLE_OOXML_TOOLS` (structural queries over the XSD schema graph):
116+
Structural queries over the XSD schema graph (powered by `xsd_*` tables):
117117

118118
- `ooxml_lookup_element` / `ooxml_lookup_type` - canonical symbol info
119119
- `ooxml_children` - legal children of an element/type/group, in document order

apps/mcp-server/src/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ import { handleMcpRequest } from "./mcp";
1616
export interface Env {
1717
DATABASE_URL: string;
1818
VOYAGE_API_KEY: string;
19-
/**
20-
* Feature flag for the OOXML structural tools. Set to "true" to expose
21-
* ooxml_lookup_element / ooxml_lookup_type / ooxml_children /
22-
* ooxml_attributes / ooxml_enum / ooxml_namespace_info via tools/list
23-
* and tools/call. Default off.
24-
*/
25-
ENABLE_OOXML_TOOLS?: string;
2619
}
2720

2821
// Part descriptions

apps/mcp-server/src/mcp.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { createDb } from "./db";
88
import { embedQuery } from "./embeddings";
99
import type { Env } from "./index";
10-
import { callOoxmlTool, isOoxmlTool, OOXML_TOOL_DEFS, ooxmlToolsEnabled } from "./ooxml-tools";
10+
import { callOoxmlTool, isOoxmlTool, OOXML_TOOL_DEFS } from "./ooxml-tools";
1111

1212
// JSON-RPC types
1313
interface JsonRpcRequest {
@@ -133,12 +133,11 @@ function handleInitialize(id: number | string | null): JsonRpcResponse {
133133
};
134134
}
135135

136-
function handleToolsList(id: number | string | null, env: Env): JsonRpcResponse {
137-
const tools = ooxmlToolsEnabled(env) ? [...TOOLS, ...OOXML_TOOL_DEFS] : TOOLS;
136+
function handleToolsList(id: number | string | null): JsonRpcResponse {
138137
return {
139138
jsonrpc: "2.0",
140139
id,
141-
result: { tools },
140+
result: { tools: [...TOOLS, ...OOXML_TOOL_DEFS] },
142141
};
143142
}
144143

@@ -162,17 +161,9 @@ async function handleToolsCall(
162161
try {
163162
let resultText: string;
164163

165-
// OOXML tools are feature-flagged; tools/list filters them out when the flag
166-
// is off, so callers should not see these tool names. Defensive check here in
167-
// case a caller hand-crafts a request.
164+
// Structural OOXML tools share the dispatch with the existing semantic
165+
// tools below.
168166
if (isOoxmlTool(name)) {
169-
if (!ooxmlToolsEnabled(env)) {
170-
return {
171-
jsonrpc: "2.0",
172-
id,
173-
error: { code: METHOD_NOT_FOUND, message: `Unknown tool: ${name}` },
174-
};
175-
}
176167
resultText = await callOoxmlTool(name, args ?? {}, env);
177168
return {
178169
jsonrpc: "2.0",
@@ -393,7 +384,7 @@ export async function handleMcpRequest(request: Request, env: Env): Promise<Resp
393384
return new Response(null, { status: 202 });
394385

395386
case "tools/list":
396-
return jsonResponse(handleToolsList(id, env));
387+
return jsonResponse(handleToolsList(id));
397388

398389
case "tools/call":
399390
return jsonResponse(await handleToolsCall(id, body.params, env));

apps/mcp-server/src/ooxml-tools.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
/**
2-
* Read-only structural MCP tools backed by the OOXML schema graph. Gated by
3-
* ENABLE_OOXML_TOOLS, which filters both tools/list discovery and tools/call
4-
* dispatch so the public surface stays unchanged until the flag is set.
2+
* Read-only structural MCP tools backed by the OOXML schema graph.
53
*
64
* Tools:
75
* ooxml_lookup_element, ooxml_lookup_type, ooxml_children,
@@ -33,12 +31,6 @@ export const DEFAULT_PROFILE = "transitional";
3331

3432
export interface OoxmlEnv {
3533
DATABASE_URL: string;
36-
ENABLE_OOXML_TOOLS?: string;
37-
}
38-
39-
export function ooxmlToolsEnabled(env: OoxmlEnv): boolean {
40-
const v = env.ENABLE_OOXML_TOOLS;
41-
return v === "true" || v === "1";
4234
}
4335

4436
export const OOXML_TOOL_DEFS = [
@@ -215,13 +207,7 @@ export async function runOoxmlTool(
215207
} else if (!elementSym) {
216208
// Fall back to looking for a named xsd:group with this qname (so
217209
// EG_PContent and friends are reachable directly).
218-
typeSym = await lookupSymbol(
219-
sql,
220-
q.qname.namespace,
221-
q.qname.localName,
222-
"group",
223-
profile,
224-
);
210+
typeSym = await lookupSymbol(sql, q.qname.namespace, q.qname.localName, "group", profile);
225211
}
226212
}
227213
if (!typeSym) {

0 commit comments

Comments
 (0)