Compare commits

...

2 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] ffc809c5be Remove text field from list_documents tool response
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
2026-02-25 15:00:54 +00:00
copilot-swe-agent[bot] 799f129e4f Initial plan 2026-02-25 14:55:10 +00:00
2 changed files with 47 additions and 11 deletions
+32
View File
@@ -228,8 +228,10 @@ describe("POST /mcp/", () => {
const match = data.find((d: { id: string }) => d.id === document.id) as {
url: string;
text?: string;
};
expect(match.url).toMatch(/^https?:\/\//);
expect(match.text).toBeUndefined();
});
it("list_documents filters by collection", async () => {
@@ -267,6 +269,36 @@ describe("POST /mcp/", () => {
(d: { collectionId: string }) => d.collectionId === collection1.id
)
).toBe(true);
expect(data.every((d: { text?: string }) => d.text === undefined)).toBe(
true
);
});
it("list_documents with query does not include text", async () => {
const { user, accessToken } = await buildOAuthUser();
const collection = await buildCollection({
teamId: user.teamId,
userId: user.id,
});
await buildDocument({
teamId: user.teamId,
userId: user.id,
collectionId: collection.id,
title: "Search Test Document",
text: "This is searchable content",
});
const res = await callMcpTool(server, accessToken, "list_documents", {
query: "searchable",
});
const data = (res?.result?.content ?? []).map((c: { text: string }) =>
JSON.parse(c.text)
);
expect(data.length).toBeGreaterThan(0);
expect(data.every((d: { text?: string }) => d.text === undefined)).toBe(
true
);
});
it("create_document creates in a collection", async () => {
+15 -11
View File
@@ -153,13 +153,15 @@ export function documentTools(server: McpServer, scopes: string[]) {
const presented = await Promise.all(
results.map(async (result) => {
const doc = pathToUrl(
user.team,
await presentDocument(undefined, result.document, {
const { text, ...attributes } = await presentDocument(
undefined,
result.document,
{
includeData: false,
includeText: false,
})
}
);
const doc = pathToUrl(user.team, attributes);
return { ...doc, context: result.context };
})
);
@@ -183,15 +185,17 @@ export function documentTools(server: McpServer, scopes: string[]) {
});
const presented = await Promise.all(
documents.map(async (document) =>
pathToUrl(
user.team,
await presentDocument(undefined, document, {
documents.map(async (document) => {
const { text, ...attributes } = await presentDocument(
undefined,
document,
{
includeData: false,
includeText: false,
})
)
)
}
);
return pathToUrl(user.team, attributes);
})
);
return success(presented);
} catch (message) {