Skip to main content
Glama
nulab

Backlog MCP Server

get_document_tree

Retrieve the hierarchical structure of documents in a Backlog project to organize and navigate wiki pages and project files.

Instructions

Gets the document tree of a project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdOrKeyYesProject ID or Key

Implementation Reference

  • Factory function defining the 'get_document_tree' tool, including its handler that fetches the document tree via the Backlog API.
    export const getDocumentTreeTool = (
      backlog: Backlog,
      { t }: TranslationHelper
    ): ToolDefinition<
      ReturnType<typeof getDocumentTreeSchema>,
      typeof DocumentTreeFullSchema
    > => {
      return {
        name: 'get_document_tree',
        description: t(
          'TOOL_GET_DOCUMENT_TREE_DESCRIPTION',
          'Gets the document tree of a project.'
        ),
        schema: z.object(getDocumentTreeSchema(t)),
        outputSchema: DocumentTreeFullSchemaZ,
        importantFields: ['projectId', 'activeTree', 'trashTree'],
        handler: async ({ projectIdOrKey }) => {
          return backlog.getDocumentTree(projectIdOrKey);
        },
      };
    };
  • Input schema definition for the tool's parameters using Zod.
    const getDocumentTreeSchema = buildToolSchema((t) => ({
      projectIdOrKey: z
        .union([z.string(), z.number()])
        .describe(
          t('TOOL_GET_DOCUMENT_TREE_PROJECT_ID_OR_KEY', 'Project ID or Key')
        ),
    }));
  • Output schema definition (Zod) for the document tree response.
    export const DocumentTreeFullSchema: z.ZodRawShape = {
      projectId: z.number(),
      activeTree: ActiveTrashTreeSchema.optional(),
      trashTree: ActiveTrashTreeSchema.optional(),
    };
    
    export const DocumentTreeFullSchemaZ = z.object(DocumentTreeFullSchema);
  • Registration of the get_document_tree tool within the 'document' toolset group in the allTools function.
    tools: [
      getDocumentsTool(backlog, helper),
      getDocumentTreeTool(backlog, helper),
      getDocumentTool(backlog, helper),
    ],

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/nulab/backlog-mcp-server'

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