Skip to main content
Glama

list_code_api_modules

Discover available TypeScript modules for code execution API operations, organized by category with descriptions to identify token-efficient bulk processing capabilities.

Instructions

List all available TypeScript modules in the code execution API.

    Returns a formatted list of all TypeScript files that can be imported
    in the execute_typescript tool, organized by category with descriptions.

    This helps Claude discover what operations are available for token-efficient
    bulk processing.

    Returns:
        Formatted string listing all available modules by category with descriptions.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_code_api_modules' tool. It scans the code_api directory for TypeScript modules, organizes them by category, adds descriptions, and formats a list with import examples. Registered via @mcp.tool() decorator.
    @mcp.tool()
    @validate_params
    async def list_code_api_modules() -> str:
        """List all available TypeScript modules in the code execution API.
    
        Returns a formatted list of all TypeScript files that can be imported
        in the execute_typescript tool, organized by category with descriptions.
    
        This helps Claude discover what operations are available for token-efficient
        bulk processing.
    
        Returns:
            Formatted string listing all available modules by category with descriptions.
        """
        code_api_dir = Path(__file__).parent.parent / "code_api"
    
        if not code_api_dir.exists():
            return "❌ Code API directory not found"
    
        # Module descriptions mapping
        module_descriptions = {
            "bulkGrade": "Grade multiple submissions with local processing function - most token-efficient method",
            "gradeWithRubric": "Grade a single submission with rubric criteria and optional comments",
            "bulkGradeDiscussion": "Grade discussion posts in bulk with local processing function",
            "listSubmissions": "Retrieve all submissions for an assignment (supports includeUser for names/emails)",
            "listCourses": "List all courses accessible to the current user",
            "getCourseDetails": "Get detailed information about a specific course",
            "sendMessage": "Send a message/announcement to course participants",
            "listDiscussions": "List discussion topics in a course",
            "postEntry": "Post an entry to a discussion topic",
        }
    
        # Organize modules by directory
        modules_by_category: dict[str, list[tuple[str, str]]] = {}
    
        for ts_file in code_api_dir.rglob("*.ts"):
            # Skip certain files
            if ts_file.name in ['index.ts', 'client.ts']:
                continue
    
            # Get relative path from code_api
            rel_path = ts_file.relative_to(code_api_dir)
    
            # Get category (parent directory name)
            category = rel_path.parent.name if rel_path.parent.name != '.' else 'root'
    
            # Get import path (convert .ts to .js for ESM imports)
            import_path = f"./{rel_path.parent}/{rel_path.stem}.js"
    
            # Get description from mapping
            module_name = rel_path.stem
            description = module_descriptions.get(module_name, "")
    
            if category not in modules_by_category:
                modules_by_category[category] = []
    
            modules_by_category[category].append((import_path, description))
    
        # Format output
        result_lines = []
        result_lines.append("Available TypeScript Modules for Code Execution")
        result_lines.append("=" * 60)
        result_lines.append("")
        result_lines.append("Import these in execute_typescript tool:")
        result_lines.append("")
    
        for category, modules in sorted(modules_by_category.items()):
            result_lines.append(f"📁 {category.upper()}")
            result_lines.append("-" * 40)
            for import_path, description in sorted(modules, key=lambda x: x[0]):
                result_lines.append(f"  {import_path}")
                if description:
                    result_lines.append(f"    • {description}")
            result_lines.append("")
    
        result_lines.append("Example Usage:")
        result_lines.append("```typescript")
        result_lines.append("import { bulkGrade } from './canvas/grading/bulkGrade.js';")
        result_lines.append("import { listSubmissions } from './canvas/assignments/listSubmissions.js';")
        result_lines.append("")
        result_lines.append("// Your code here...")
        result_lines.append("```")
    
        return "\n".join(result_lines)
  • Calls the register_code_execution_tools function within register_all_tools, which registers the list_code_api_modules tool among others.
    register_code_execution_tools(mcp)
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/vishalsachdev/canvas-mcp'

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