pagespace-mcp
Version:
Model Context Protocol (MCP) server for PageSpace with complete workspace management, powerful search, batch operations, and AI agent capabilities. Provides external access to all core PageSpace functionality.
769 lines • 25.3 kB
JavaScript
export const tools = [
{
name: 'list_drives',
description: 'Start here - list all available drives in the workspace. Use this first to see what drives you have access to.',
inputSchema: {
type: 'object',
properties: {},
additionalProperties: false,
},
},
{
name: 'list_pages',
description: 'After using list_drives, explore the page tree structure within a specific drive. Requires both driveSlug and driveId from list_drives.',
inputSchema: {
type: 'object',
properties: {
driveSlug: {
type: 'string',
description: 'The human-readable slug of the drive (for semantic understanding)',
},
driveId: {
type: 'string',
description: 'The unique ID of the drive (used for operations)',
},
},
required: ['driveSlug', 'driveId'],
additionalProperties: false,
},
},
{
name: 'read_page',
description: 'Read any specific document to understand its content. Use the page ID from list_pages output.',
inputSchema: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The unique ID of the page to read (get this from list_pages output)',
},
},
required: ['pageId'],
additionalProperties: false,
},
},
{
name: 'replace_lines',
description: 'After reading a document, replace specific line(s) with new content. Use pageId from read_page and line numbers from document content.',
inputSchema: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The unique ID of the page to edit (get this from list_pages)',
},
startLine: {
type: 'number',
description: 'Starting line number (1-based)',
},
endLine: {
type: 'number',
description: 'Ending line number (1-based, optional, defaults to startLine)',
},
content: {
type: 'string',
description: 'New content to replace the lines with',
},
},
required: ['pageId', 'startLine', 'content'],
},
},
{
name: 'insert_lines',
description: 'After reading a document, insert new content at a specific line. Use pageId from read_page and line position from document content.',
inputSchema: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The unique ID of the page to edit (get this from list_pages)',
},
lineNumber: {
type: 'number',
description: 'Line number where to insert content (1-based)',
},
content: {
type: 'string',
description: 'Content to insert',
},
},
required: ['pageId', 'lineNumber', 'content'],
},
},
{
name: 'delete_lines',
description: 'After reading a document, delete specific line(s). Use pageId from read_page and line numbers from document content.',
inputSchema: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The unique ID of the page to edit (get this from list_pages)',
},
startLine: {
type: 'number',
description: 'Starting line number to delete (1-based)',
},
endLine: {
type: 'number',
description: 'Ending line number to delete (1-based, optional, defaults to startLine)',
},
},
required: ['pageId', 'startLine'],
},
},
{
name: 'append_to_page',
description: 'After reading a page, add new content to the end. Use pageId from read_page.',
inputSchema: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The unique ID of the page to edit (get this from list_pages)',
},
content: {
type: 'string',
description: 'Content to append',
},
},
required: ['pageId', 'content'],
},
},
{
name: 'prepend_to_page',
description: 'After reading a page, add new content to the beginning. Use pageId from read_page.',
inputSchema: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The unique ID of the page to edit (get this from list_pages)',
},
content: {
type: 'string',
description: 'Content to prepend',
},
},
required: ['pageId', 'content'],
},
},
{
name: 'create_page',
description: 'Create a new page in a specific drive. Supports all page types: FOLDER, DOCUMENT, CHANNEL, AI_CHAT, CANVAS.',
inputSchema: {
type: 'object',
properties: {
driveId: {
type: 'string',
description: 'The unique ID of the drive to create the page in (get this from list_drives)',
},
parentId: {
type: 'string',
description: 'The unique ID of the parent page (omit for root level, get this from list_pages)',
},
title: {
type: 'string',
description: 'The title of the new page',
},
type: {
type: 'string',
enum: ['FOLDER', 'DOCUMENT', 'CHANNEL', 'AI_CHAT', 'CANVAS'],
description: 'The type of page to create',
},
content: {
type: 'string',
description: 'Optional initial content for the page',
},
},
required: ['driveId', 'title', 'type'],
},
},
{
name: 'rename_page',
description: 'Rename an existing page. Use pageId from list_pages.',
inputSchema: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The unique ID of the page to rename (get this from list_pages)',
},
title: {
type: 'string',
description: 'New title for the page',
},
},
required: ['pageId', 'title'],
},
},
{
name: 'trash_page',
description: 'Move a single page to trash (soft delete). If the page has children, they are NOT trashed and remain in place.',
inputSchema: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The unique ID of the page to trash (get this from list_pages)',
},
},
required: ['pageId'],
},
},
{
name: 'trash_page_with_children',
description: 'Move a page AND all its children to trash recursively. Use when you want to trash an entire hierarchy.',
inputSchema: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The unique ID of the page to trash (will trash this page and ALL its children recursively)',
},
},
required: ['pageId'],
},
},
{
name: 'restore_page',
description: 'Restore a page from trash. Use page ID from list_trash.',
inputSchema: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The page ID of the trashed page (get this from list_trash)',
},
},
required: ['pageId'],
},
},
{
name: 'move_page',
description: 'Move or reorder a page within the same drive. Use page IDs from list_pages.',
inputSchema: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The unique ID of the page to move (get this from list_pages)',
},
newParentId: {
type: 'string',
description: 'New parent page ID (omit for root level, get this from list_pages)',
},
position: {
type: 'number',
description: 'Position within the new parent (1-based, higher numbers appear later)',
},
},
required: ['pageId', 'position'],
},
},
{
name: 'list_trash',
description: 'List all trashed pages in a specific drive. Requires both driveSlug and driveId from list_drives.',
inputSchema: {
type: 'object',
properties: {
driveSlug: {
type: 'string',
description: 'The human-readable slug of the drive (for semantic understanding)',
},
driveId: {
type: 'string',
description: 'The unique ID of the drive (used for operations)',
},
},
required: ['driveSlug', 'driveId'],
},
},
{
name: 'create_drive',
description: 'Create a new workspace/drive. Use when user explicitly requests a new workspace or when their project clearly doesn\'t fit existing drives.',
inputSchema: {
type: 'object',
properties: {
name: {
type: 'string',
description: 'The name of the new drive/workspace',
},
},
required: ['name'],
},
},
{
name: 'rename_drive',
description: 'Rename an existing workspace/drive. Only the drive owner can rename their drives.',
inputSchema: {
type: 'object',
properties: {
driveId: {
type: 'string',
description: 'The unique ID of the drive to rename (get this from list_drives)',
},
name: {
type: 'string',
description: 'The new name for the drive',
},
},
required: ['driveId', 'name'],
},
},
{
name: 'trash_drive',
description: 'Move a workspace/drive to trash. USE WITH EXTREME CAUTION - only use when explicitly requested by the user to delete or trash a drive. The drive can be restored from trash later.',
inputSchema: {
type: 'object',
properties: {
driveId: {
type: 'string',
description: 'The unique ID of the drive to trash (get this from list_drives)',
},
confirmDriveName: {
type: 'string',
description: 'The exact name of the drive (for safety confirmation)',
},
},
required: ['driveId', 'confirmDriveName'],
},
},
{
name: 'restore_drive',
description: 'Restore a trashed workspace/drive back to active state. Returns the drive and all its pages to normal accessibility.',
inputSchema: {
type: 'object',
properties: {
driveId: {
type: 'string',
description: 'The unique ID of the drive to restore',
},
},
required: ['driveId'],
},
},
{
name: 'regex_search',
description: 'Search page content using regular expression patterns. Returns pages that match the pattern with their IDs, titles, and semantic paths for reference. Essential for finding specific content patterns across your workspace.',
inputSchema: {
type: 'object',
properties: {
driveId: {
type: 'string',
description: 'The unique ID of the drive to search in',
},
pattern: {
type: 'string',
description: 'Regular expression pattern to search for (e.g., "TODO.*urgent", "\\d{4}-\\d{2}-\\d{2}", "deprecated.*API")',
},
searchIn: {
type: 'string',
enum: ['content', 'title', 'both'],
description: 'Where to search: content only, title only, or both (defaults to content)',
},
maxResults: {
type: 'number',
description: 'Maximum number of results to return (defaults to 50)',
},
},
required: ['driveId', 'pattern'],
additionalProperties: false,
},
},
{
name: 'glob_search',
description: 'Find pages using glob-style patterns for titles and paths. Useful for discovering structural patterns like "README*", "*/meeting-notes/*", or "**/*.test".',
inputSchema: {
type: 'object',
properties: {
driveId: {
type: 'string',
description: 'The unique ID of the drive to search in',
},
pattern: {
type: 'string',
description: 'Glob pattern to match page titles/paths (e.g., "**/README*", "docs/**/*.md", "meeting-*")',
},
includeTypes: {
type: 'array',
items: {
type: 'string',
enum: ['FOLDER', 'DOCUMENT', 'AI_CHAT', 'CHANNEL', 'CANVAS'],
},
description: 'Filter by page types (optional)',
},
maxResults: {
type: 'number',
description: 'Maximum number of results to return (defaults to 100)',
},
},
required: ['driveId', 'pattern'],
additionalProperties: false,
},
},
{
name: 'multi_drive_search',
description: 'Search for content across multiple drives at once. Automatically filters results based on user permissions.',
inputSchema: {
type: 'object',
properties: {
searchQuery: {
type: 'string',
description: 'Text to search for in page content and titles',
},
searchType: {
type: 'string',
enum: ['text', 'regex'],
description: 'Use text for simple search, regex for pattern matching (defaults to text)',
},
maxResultsPerDrive: {
type: 'number',
description: 'Maximum results to return per drive (defaults to 20)',
},
},
required: ['searchQuery'],
additionalProperties: false,
},
},
{
name: 'bulk_move_pages',
description: 'Move multiple pages to a new parent location in one operation. Maintains relative positions. Use this instead of multiple move_page calls for efficiency and atomicity.',
inputSchema: {
type: 'object',
properties: {
pageIds: {
type: 'array',
items: { type: 'string' },
description: 'Array of page IDs to move',
},
targetParentId: {
type: 'string',
description: 'Target parent page ID (omit for root)',
},
targetDriveId: {
type: 'string',
description: 'Target drive ID',
},
maintainOrder: {
type: 'boolean',
description: 'Maintain relative order of moved pages (defaults to true)',
},
},
required: ['pageIds', 'targetDriveId'],
additionalProperties: false,
},
},
{
name: 'bulk_rename_pages',
description: 'Rename multiple pages using find/replace patterns or templates.',
inputSchema: {
type: 'object',
properties: {
pageIds: {
type: 'array',
items: { type: 'string' },
description: 'Array of page IDs to rename',
},
renamePattern: {
type: 'object',
properties: {
type: {
type: 'string',
enum: ['find_replace', 'prefix', 'suffix', 'template'],
description: 'The type of rename pattern',
},
find: {
type: 'string',
description: 'For find_replace: Text to find in titles',
},
replace: {
type: 'string',
description: 'For find_replace: Text to replace with',
},
caseSensitive: {
type: 'boolean',
description: 'For find_replace: Whether to be case sensitive',
},
prefix: {
type: 'string',
description: 'For prefix: Prefix to add to all titles',
},
suffix: {
type: 'string',
description: 'For suffix: Suffix to add to all titles',
},
template: {
type: 'string',
description: 'For template: Template with {title} and {index} placeholders',
},
},
required: ['type'],
description: 'Pattern to use for renaming',
},
},
required: ['pageIds', 'renamePattern'],
additionalProperties: false,
},
},
{
name: 'bulk_delete_pages',
description: 'Delete multiple pages in one atomic operation. All deletions succeed or all fail together.',
inputSchema: {
type: 'object',
properties: {
pageIds: {
type: 'array',
items: { type: 'string' },
description: 'Array of page IDs to delete',
},
includeChildren: {
type: 'boolean',
description: 'Whether to delete child pages too (defaults to false)',
},
},
required: ['pageIds'],
additionalProperties: false,
},
},
{
name: 'bulk_update_content',
description: 'Update content in multiple pages in one atomic operation. All updates succeed or all fail together.',
inputSchema: {
type: 'object',
properties: {
updates: {
type: 'array',
items: {
type: 'object',
properties: {
pageId: {
type: 'string',
description: 'The page ID to update',
},
content: {
type: 'string',
description: 'The new content for the page',
},
operation: {
type: 'string',
enum: ['replace', 'append', 'prepend'],
description: 'How to apply the content (defaults to replace)',
},
},
required: ['pageId', 'content'],
},
description: 'Array of content updates to apply',
},
},
required: ['updates'],
additionalProperties: false,
},
},
{
name: 'create_folder_structure',
description: 'Create a complex folder structure with multiple nested folders and documents in one operation.',
inputSchema: {
type: 'object',
properties: {
driveId: {
type: 'string',
description: 'Drive ID to create structure in',
},
parentId: {
type: 'string',
description: 'Parent page ID (omit for root)',
},
structure: {
type: 'array',
items: {
type: 'object',
properties: {
title: { type: 'string' },
type: {
type: 'string',
enum: ['FOLDER', 'DOCUMENT', 'AI_CHAT', 'CHANNEL', 'CANVAS'],
},
content: { type: 'string' },
children: {
type: 'array',
items: {
type: 'object',
properties: {
title: { type: 'string' },
type: {
type: 'string',
enum: ['FOLDER', 'DOCUMENT', 'AI_CHAT', 'CHANNEL', 'CANVAS'],
},
content: { type: 'string' },
},
required: ['title', 'type'],
},
},
},
required: ['title', 'type'],
},
description: 'Hierarchical structure to create',
},
},
required: ['driveId', 'structure'],
additionalProperties: false,
},
},
{
name: 'create_agent',
description: 'Create a new AI agent with custom system prompt and tool configuration. This is a specialized version of create_page optimized for AI agent creation. The agent will be created as an AI_CHAT page type with full configuration. Use this to build specialized assistants for different workflows.',
inputSchema: {
type: 'object',
properties: {
driveId: {
type: 'string',
description: 'The unique ID of the drive to create the agent in',
},
parentId: {
type: 'string',
description: 'The unique ID of the parent page - REQUIRED when creating inside any page (folder, document, etc). Only omit for root-level agents.',
},
title: {
type: 'string',
description: 'The name/title of the AI agent (e.g., "Content Writer", "Code Assistant", "Research Helper")',
},
systemPrompt: {
type: 'string',
description: 'System prompt defining the agent\'s behavior, personality, expertise, and instructions. This controls how the agent responds and what role it plays.',
},
enabledTools: {
type: 'array',
items: { type: 'string' },
description: 'Array of tool names to enable for this agent. Available tools include: regex_search, glob_search, multi_drive_search, read_page, create_page, rename_page, append_to_page, replace_lines, and more. Leave empty for a chat-only agent.',
},
aiProvider: {
type: 'string',
description: 'AI provider for this agent (e.g., "openrouter", "google", "anthropic"). Overrides user default.',
},
aiModel: {
type: 'string',
description: 'AI model for this agent (e.g., "gpt-4", "claude-3-sonnet"). Overrides user default.',
},
welcomeMessage: {
type: 'string',
description: 'Optional welcome message shown when users first interact with the agent.',
},
},
required: ['driveId', 'title', 'systemPrompt'],
additionalProperties: false,
},
},
{
name: 'update_agent_config',
description: 'Update the configuration of an existing AI agent, including system prompt, enabled tools, AI provider, and model settings.',
inputSchema: {
type: 'object',
properties: {
agentPath: {
type: 'string',
description: 'The agent path using titles like "/driveSlug/Agent Name" for semantic context',
},
agentId: {
type: 'string',
description: 'The unique ID of the AI agent to update',
},
systemPrompt: {
type: 'string',
description: 'New system prompt for the agent. Leave empty to keep current prompt.',
},
enabledTools: {
type: 'array',
items: { type: 'string' },
description: 'New array of enabled tool names. Leave empty to keep current tools.',
},
aiProvider: {
type: 'string',
description: 'New AI provider for the agent',
},
aiModel: {
type: 'string',
description: 'New AI model for the agent',
},
},
required: ['agentPath', 'agentId'],
additionalProperties: false,
},
},
{
name: 'list_agents',
description: 'List all AI agents in a specific drive. Returns only AI_CHAT pages with their configuration.',
inputSchema: {
type: 'object',
properties: {
driveId: {
type: 'string',
description: 'The unique ID of the drive to list agents from',
},
driveSlug: {
type: 'string',
description: 'The drive slug for semantic context (e.g., "marketing", "dev-tools")',
},
includeSystemPrompt: {
type: 'boolean',
description: 'Include the full system prompt for each agent (defaults to false)',
},
includeTools: {
type: 'boolean',
description: 'Include the list of enabled tools for each agent (defaults to true)',
},
},
required: ['driveId'],
additionalProperties: false,
},
},
{
name: 'multi_drive_list_agents',
description: 'List all AI agents across ALL accessible drives. Useful for discovering agents throughout your entire workspace.',
inputSchema: {
type: 'object',
properties: {
includeSystemPrompt: {
type: 'boolean',
description: 'Include the full system prompt for each agent (defaults to false)',
},
includeTools: {
type: 'boolean',
description: 'Include the list of enabled tools for each agent (defaults to true)',
},
groupByDrive: {
type: 'boolean',
description: 'Group results by drive for better organization (defaults to true)',
},
},
additionalProperties: false,
},
},
{
name: 'ask_agent',
description: 'Consult another AI agent in the workspace for specialized knowledge or assistance. The target agent will process your question with its full conversation history and configuration, but the interaction will not be saved to the target agent\'s conversation. Use this to leverage specialized agents for complex workflows.',
inputSchema: {
type: 'object',
properties: {
agentPath: {
type: 'string',
description: 'Semantic path to the agent (e.g., "/finance/Budget Analyst", "/dev/Code Assistant") for context and user readability',
},
agentId: {
type: 'string',
description: 'Unique ID of the AI agent page to consult',
},
question: {
type: 'string',
description: 'Question or request for the target agent. Be specific and provide context.',
},
context: {
type: 'string',
description: 'Additional context about why you\'re asking this question or what you need the response for',
},
},
required: ['agentPath', 'agentId', 'question'],
additionalProperties: false,
},
},
]