Skip to main content
Glama
funwarioisii

Cosense MCP Server

by funwarioisii

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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: [],
      },
    },
  • Type definition for the ListPagesResponse returned by the listPages API helper.
    type ListPagesResponse = {
      limit: number;
      count: number;
      skip: number;
      projectName: string;
      pages: {
        title: string;
      }[];
    };
  • 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;
    }
  • 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}`,
      })),
    );
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/funwarioisii/cosense-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server