Files
mcpctl/.taskmaster/tasks/task_077.md

64 lines
1.6 KiB
Markdown
Raw Normal View History

# Task ID: 77
**Title:** Implement passthrough and paginate Stages
**Status:** done
**Dependencies:** 71 ✓
**Priority:** high
**Description:** Create the built-in passthrough (no-op) and paginate (large response splitting) stages that form the default proxymodel.
**Details:**
Create `src/mcplocal/src/proxymodel/stages/passthrough.ts`:
```typescript
import type { StageHandler } from '../types';
const handler: StageHandler = async (content, ctx) => {
return { content };
};
export default handler;
```
Create `src/mcplocal/src/proxymodel/stages/paginate.ts`:
```typescript
import type { StageHandler, Section } from '../types';
const handler: StageHandler = async (content, ctx) => {
const pageSize = (ctx.config.pageSize as number) ?? 8000;
if (content.length <= pageSize) {
return { content };
}
const pages: Section[] = [];
let offset = 0;
let pageNum = 1;
while (offset < content.length) {
const pageContent = content.slice(offset, offset + pageSize);
pages.push({
id: `page-${pageNum}`,
title: `Page ${pageNum}`,
content: pageContent,
});
offset += pageSize;
pageNum++;
}
return {
content: `Content split into ${pages.length} pages (${content.length} chars total). Use section parameter to read specific pages.`,
sections: pages,
};
};
export default handler;
```
**Test Strategy:**
passthrough: verify content returned unchanged. paginate: verify content under threshold returns unchanged, content over threshold splits correctly, page boundaries are correct, section IDs are sequential.