Skip to main content
Glama

get_sections

Extract all sections from a LaTeX file to analyze and understand its structure. Requires the file path and integrates with Overleaf projects via Git for efficient document processing.

Instructions

Get all sections from a LaTeX file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filePathYesPath to the LaTeX file
gitTokenNoGit token (optional, uses env var)
projectIdNoProject ID (optional, uses env var)
projectNameNoProject name (default, project2, etc.)

Implementation Reference

  • Core handler function that parses LaTeX file content to extract sections using regex matching for \section, \subsection, \subsubsection commands.
    async getSections(filePath) { const content = await this.readFile(filePath); const sections = []; const sectionRegex = /\\(?:section|subsection|subsubsection)\{([^}]+)\}/g; let match; while ((match = sectionRegex.exec(content)) !== null) { sections.push({ title: match[1], type: match[0].split('{')[0].replace('\\', ''), index: match.index }); } return sections; }
  • MCP server dispatch handler for 'get_sections' tool call, which instantiates the client and invokes the core getSections method.
    case 'get_sections': { const client = getProject(args.projectName); const sections = await client.getSections(args.filePath); return { content: [ { type: 'text', text: JSON.stringify(sections, null, 2), }, ], }; }
  • Tool registration in ListTools response, defining name, description, and input schema for get_sections tool.
    { name: 'get_sections', description: 'Get all sections from a LaTeX file', inputSchema: { type: 'object', properties: { filePath: { type: 'string', description: 'Path to the LaTeX file', }, projectName: { type: 'string', description: 'Project identifier (optional)', }, }, required: ['filePath'], }, },
  • Input schema defining parameters for the get_sections tool.
    inputSchema: { type: 'object', properties: { filePath: { type: 'string', description: 'Path to the LaTeX file', }, projectName: { type: 'string', description: 'Project identifier (optional)', }, }, required: ['filePath'], },

Other Tools

Related 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/mjyoo2/OverleafMCP'

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