Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ web mcp --provider brave
```

The server exposes five read-only tools: `search`, `fetch`, `docs_resolve`,
`docs_fetch`, and `sgraph_search`. Its stdout is reserved for MCP protocol
`docs_fetch`, and `source_search`. Its stdout is reserved for MCP protocol
messages; diagnostics go to stderr. For a client-rendered page, explicitly call
`fetch` with `render: "agent-browser"` and an integer `waitMs`; this optional
retry requires a host-installed executable and never happens automatically.
Expand All @@ -77,7 +77,7 @@ Install the independently bundled Pi extension:
pi install npm:@guionai/pi-web
```

It registers `web_search`, `web_fetch`, `web_docs`, and `web_sgraph` and calls
It registers `web_search`, `web_fetch`, `web_docs`, and `web_source_search` and calls
the bundled core in-process. Pi and TypeBox are peer dependencies supplied by
the host; no CLI executable or MCP configuration is required. `web_fetch` uses
direct fetch by default and can explicitly use `render: "agent-browser"` with
Expand Down
8 changes: 6 additions & 2 deletions packages/dsh-web/src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,17 @@ function webSgraphTool(
): ToolDefinition {
return strictDefinition(
defineTool({
name: "web_sgraph",
name: "web_source_search",
description: "Search public source code through Sourcegraph.",
parameters: sgraphParameters,
output: sgraphOutput,
isConcurrencySafe: () => true,
async execute(args, exec) {
rejectUnknownFields(args, Object.keys(sgraphParameters), "web_sgraph");
rejectUnknownFields(
args,
Object.keys(sgraphParameters),
"web_source_search",
);
return operations.sgraphSearch({
query: requireString(args, "query"),
count: args.count,
Expand Down
4 changes: 2 additions & 2 deletions packages/dsh-web/test/tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ describe("DSH direct web tools", () => {
expect(definitions.map((definition) => definition.name)).toEqual([
"web_fetch",
"web_docs",
"web_sgraph",
"web_source_search",
]);
expect(registered.map((definition) => definition.name)).toEqual([
"web_fetch",
"web_docs",
"web_sgraph",
"web_source_search",
]);
expect([
definitions[0]!.isConcurrencySafe?.({ url: "https://example.test" }),
Expand Down
6 changes: 3 additions & 3 deletions packages/pi-web/src/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const DOCS_PROMPT_GUIDELINES = [
"For web_docs action fetch, provide the library_id returned by action resolve; use topic or tokens to narrow the result.",
];
const SGRAPH_PROMPT_GUIDELINES = [
"Use web_sgraph to search public source code through Sourcegraph.",
"Use web_source_search to search public source code through Sourcegraph.",
];

function environmentCredentials(): WebCredentials {
Expand Down Expand Up @@ -383,11 +383,11 @@ export function webDocsTool(dependencies: WebToolDependencies = {}) {
export function webSgraphTool(dependencies: WebToolDependencies = {}) {
const operations = dependencies.operations ?? createWebOperations();
return makeTool({
name: "web_sgraph",
name: "web_source_search",
label: "Web source search",
description:
"Search public source code through Sourcegraph. Text output is limited to 2,000 lines or 50KB; truncated output is saved to a temporary file.",
promptSnippet: "Search public source code with web_sgraph",
promptSnippet: "Search public source code with web_source_search",
promptGuidelines: SGRAPH_PROMPT_GUIDELINES,
parameters: webSgraphSchema,
execute: async (params, signal) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/pi-web/test/packed-smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ try {
extension.default({ registerTool: (tool) => registered.push(tool) });
if (
registered.map((tool) => tool.name).join(",") !==
"web_search,web_fetch,web_docs,web_sgraph"
"web_search,web_fetch,web_docs,web_source_search"
) {
throw new Error("packed extension did not register exactly four web tools");
}
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/mcp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export function createMcpServer(dependencies: McpDependencies): McpServer {
);

server.registerTool(
"sgraph_search",
"source_search",
toolConfig(
"Search public source code",
"Search public source code through Sourcegraph and return Markdown results.",
Expand Down
6 changes: 3 additions & 3 deletions packages/web/test/mcp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ describe("web stdio MCP adapter", () => {
"docs_resolve",
"fetch",
"search",
"sgraph_search",
"source_search",
]);
for (const tool of tools) {
expect(tool.annotations).toMatchObject({
Expand All @@ -233,7 +233,7 @@ describe("web stdio MCP adapter", () => {
>;
const docsFetchProperties = byName.docs_fetch!.inputSchema
.properties! as Record<string, unknown>;
const sgraphProperties = byName.sgraph_search!.inputSchema
const sgraphProperties = byName.source_search!.inputSchema
.properties! as Record<string, unknown>;
expect(fetchProperties.tree_threshold).toMatchObject({ default: 5000 });
expect(fetchProperties.render).toMatchObject({
Expand Down Expand Up @@ -283,7 +283,7 @@ describe("web stdio MCP adapter", () => {
},
});
const sgraph = await client.callTool({
name: "sgraph_search",
name: "source_search",
arguments: { query: "repo:guionai" },
});

Expand Down
2 changes: 1 addition & 1 deletion packages/web/test/packed-smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ else console.log(JSON.stringify({ success: true, data: {} }));
"docs_resolve",
"fetch",
"search",
"sgraph_search",
"source_search",
])
) {
throw new Error(`packed MCP tools = ${names.join(", ")}`);
Expand Down
Loading