feat(mcp): add outgoing document status and calendar tools

This commit is contained in:
2026-10-11 13:08:29 +02:00
parent 899e5bb339
commit f4fdf6fe30
8 changed files with 582 additions and 49 deletions

View File

@@ -10,8 +10,9 @@ const tables = Object.values(schema).filter((value: any) => {
try { return typeof getTableName(value) === "string" } catch { return false }
})
// Document tools also check portal profiles and join inbox receipts; covered in mcpDocuments.test.ts.
for (const tool of mcpTools.filter((tool) => (tool.inputSchema.properties as any)?.offset && !tool.name.startsWith("documents."))) {
// Document/status tools load related records; their dedicated tests cover filtered pagination.
for (const tool of mcpTools.filter((tool) => (tool.inputSchema.properties as any)?.offset && !tool.name.startsWith("documents.")
&& tool.name !== "accounting.outgoing_documents.status.list")) {
test(`${tool.name}: retrieves 205 records across stable, bounded pages`, async () => {
const db = drizzle(async (sql, params) => {
if (sql.includes('from "tenants"')) return { rows: [["skr03"]] }
@@ -43,7 +44,7 @@ for (const tool of mcpTools.filter((tool) => (tool.inputSchema.properties as any
const ids: unknown[] = []
let offset = 0
for (let page = 0; page < 3; page++) {
const result: any = await tool.handler(context, { id: 1, limit: 100, offset })
const result: any = await tool.handler(context, { ...((tool.inputSchema.properties as any).id ? { id: 1 } : {}), limit: 100, offset })
assert.equal(result.rows.length, page < 2 ? 100 : 5)
assert.equal(result.pagination.hasMore, page < 2)
assert.equal(result.pagination.nextOffset, page < 2 ? offset + 100 : null)