Skip to main content
Glama
huiseo
by huiseo

batch_create_documents

Create multiple documents simultaneously in Outline wiki to save time when adding content to collections.

Instructions

Create multiple documents at once.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
documentsYes

Implementation Reference

  • The main handler function for batch_create_documents. It checks access, then uses runBatch to create multiple documents via API calls to '/documents.create', handling errors and returning batch summary.
    async batch_create_documents(args: BatchCreateDocumentsInput) {
      checkAccess(config, 'batch_create_documents');
    
      return runBatch(args.documents, async (doc) => {
        try {
          const { data } = await apiCall(() =>
            apiClient.post<OutlineDocument>('/documents.create', {
              title: doc.title,
              text: doc.text,
              collectionId: doc.collectionId,
              parentDocumentId: doc.parentDocumentId,
              publish: doc.publish,
            })
          );
          return { success: true, id: data.id, title: data.title };
        } catch (error) {
          return { success: false, title: doc.title, error: getErrorMessage(error) };
        }
      });
    },
  • Zod schema definition for batchCreateDocuments input, validating an array of document objects with title, text, collectionId, etc.
    export const batchCreateDocumentsSchema = z.object({
      documents: z.array(z.object({
        title: z.string().min(1),
        text: z.string().default(''),
        collectionId,
        parentDocumentId: z.string().uuid().optional(),
        publish: z.boolean().default(true),
      })).min(1, 'At least one document is required'),
    });
  • Tool registration in allTools array using createTool, which converts the Zod schema to JSON schema for MCP tool definition.
    'batch_create_documents',
    'Create multiple documents at once.',
    'batch_create_documents'

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/huiseo/outline-wiki-mcp'

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