list_pages
Retrieve all pages from a Cosense project to access content and manage project structure for collaboration and documentation.
Instructions
List known cosense pages from my-project project on cosen.se
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:144-153 (handler)Handler for the list_pages tool call. Returns a text content block with newline-separated list of page names from pre-fetched resources.case "list_pages": { return { content: [ { type: "text", text: resources.map((resource) => resource.name).join("\n"), }, ], }; }
- src/index.ts:111-119 (registration)Registration of the list_pages tool in the ListToolsRequestSchema handler, including name, description, and empty input schema.{ name: "list_pages", description: `List known cosense pages from ${projectName} project on cosen.se`, inputSchema: { type: "object", properties: {}, required: [], }, },
- src/cosense.ts:63-71 (schema)Type definition for the ListPagesResponse returned by the listPages API helper.type ListPagesResponse = { limit: number; count: number; skip: number; projectName: string; pages: { title: string; }[]; };
- src/cosense.ts:73-84 (helper)Helper function listPages that fetches the list of pages from the cosen.se API for the given project.async function listPages( projectName: string, sid?: string, ): Promise<ListPagesResponse> { const response = sid ? await fetch(`https://cosen.se/api/pages/${projectName}`, { headers: { Cookie: `connect.sid=${sid}` }, }) : await fetch(`https://cosen.se/api/pages/${projectName}`); const pages = await response.json(); return pages as ListPagesResponse; }
- src/index.ts:19-26 (helper)Initialization of resources list using listPages helper, mapping pages to MCP resource format for use in tool handler and resource listing.const resources = await listPages(projectName, cosenseSid).then((pages) => pages.pages.map((page) => ({ uri: `cosense:///${page.title}`, mimeType: "text/plain", name: page.title, description: `A text page: ${page.title}`, })), );