mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
Remove text field from list_documents tool response
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
This commit is contained in:
@@ -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
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user