Skip to main content
Glama

get_dartboards

Retrieve available dartboards from a specified space using the space DUID to organize and manage workspace resources.

Instructions

Get available dartboards

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
space_duidYesSpace DUID to get dartboards from

Implementation Reference

  • Handler for the 'get_dartboards' tool call. Constructs Python code to retrieve and print available dartboards from the user's bundle (default dartboards), executes it via runDartCommand, and returns the output as text content.
                    case 'get_dartboards': {
                        console.error('[Debug] Handling get_dartboards request');
                        const pythonCode = `    # Get dartboards for the space
    print("[Debug] Getting dartboards", file=sys.stderr)
    try:
        # Get dartboards from the bundle
        dartboards = bundle.dartboards
        print("[Debug] Got dartboards:", dartboards, file=sys.stderr)
        if not dartboards:
            print("No dartboards found")
            sys.exit(1)
        # Print dartboard titles
        print("Available dartboards:")
        for d in dartboards:
            print(f"- {d['title']} (DUID: {d['duid']})")
    except Exception as e:
        print(f"[Debug] Error getting dartboards: {str(e)}", file=sys.stderr)
        sys.exit(1)`;
    
                        // Add proper indentation to the Python code
                        const command = pythonCode.split('\n').map(line => line.length > 0 ? '    ' + line : line).join('\n');
    
                        console.error('[Debug] Running Python command for getting dartboards');
                        const output = await this.runDartCommand(command);
                        console.error('[Debug] Get dartboards output:', output);
                        const response = {
                            content: [{
                                type: 'text',
                                text: output,
                            }],
                        };
                        return response;
                    }
  • src/index.ts:333-344 (registration)
    Registration of the 'get_dartboards' tool in the ListTools response, including name, description, and input schema (note: schema requires space_duid, but handler does not use it).
    name: 'get_dartboards',
    description: 'Get available dartboards',
    inputSchema: {
        type: 'object',
        properties: {
            space_duid: {
                type: 'string',
                description: 'Space DUID to get dartboards from',
            }
        },
        required: ['space_duid'],
    },
  • Input schema definition for the 'get_dartboards' tool, specifying a required space_duid parameter.
    name: 'get_dartboards',
    description: 'Get available dartboards',
    inputSchema: {
        type: 'object',
        properties: {
            space_duid: {
                type: 'string',
                description: 'Space DUID to get dartboards from',
            }
        },
        required: ['space_duid'],
    },
  • Helper method runDartCommand used by all tools including get_dartboards to execute dynamic Python code via child_process.spawn, which interacts with the Dart library.
        async runDartCommand(args) {
            return new Promise((resolve, reject) => {
                // Use pyenv Python
                const pythonPath = '/Users/speed/.pyenv/shims/python';
                console.error('[Debug] Running Python command with:', pythonPath);
                
                const command = `import sys
    import os
    import traceback
    import json
    from dart import Dart, Operation, OperationKind, OperationModelKind, TaskCreate, TaskUpdate, TransactionKind, TaskSourceType, SpaceCreate
    from dart.generated.types import UNSET
    from dart.dart import _Session, UserBundle, _make_duid
    from dart.generated.models.icon_kind import IconKind
    from dart.generated.models.sprint_mode import SprintMode
    from dart.generated.models.validation_error_response import ValidationErrorResponse
    
    def initialize():
        print("[Debug] Starting Python execution", file=sys.stderr)
        print("[Debug] Current directory:", os.getcwd(), file=sys.stderr)
        print("[Debug] PYTHONPATH:", os.environ.get('PYTHONPATH'), file=sys.stderr)
        print("[Debug] DART_TOKEN:", os.environ.get('DART_TOKEN'), file=sys.stderr)
        
        session = _Session()
        print("[Debug] Session created", file=sys.stderr)
        bundle = UserBundle(session)
        print("[Debug] UserBundle created", file=sys.stderr)
        dartboard_duid = bundle.default_dartboard["duid"]
        print(f"[Debug] Got dartboard DUID: {dartboard_duid}", file=sys.stderr)
        client = Dart()
        print("[Debug] Dart client created", file=sys.stderr)
        
        return client, bundle, dartboard_duid
    
    def run_command(client, bundle, dartboard_duid):
        ${args}
    
    def main():
        client, bundle, dartboard_duid = initialize()
        run_command(client, bundle, dartboard_duid)
    
    try:
        main()
    except Exception as e:
        print(f"Error: {str(e)}", file=sys.stderr)
        traceback.print_exc(file=sys.stderr)
        sys.exit(1)`;
                
                console.error('[Debug] Python command:', command);
    
                // Create a clean environment without virtual env variables
                const env = { ...process.env };
                delete env.VIRTUAL_ENV;
                delete env.CONDA_PREFIX;
                delete env.CONDA_DEFAULT_ENV;
                delete env.CONDA_PYTHON_EXE;
    
                const childProcess = spawn(pythonPath, ['-c', command], {
                    env: {
                        ...env,
                        PYTHONUNBUFFERED: '1',
                        PYTHONPATH: process.env.PYTHONPATH || process.cwd(),
                        DART_TOKEN: process.env.DART_TOKEN,
                    },
                    stdio: ['pipe', 'pipe', 'pipe'],
                });
    
                let output = '';
                let errorOutput = '';
    
                childProcess.stdout?.on('data', (data) => {
                    const str = data.toString();
                    console.error('[Debug] Python stdout:', str);
                    output += str;
                });
    
                childProcess.stderr?.on('data', (data) => {
                    const str = data.toString();
                    console.error('[Debug] Python stderr:', str);
                    errorOutput += str;
                });
    
                childProcess.on('error', (error) => {
                    console.error('[Debug] Python process error:', error);
                    reject(new Error(`Failed to start Python process: ${error.message}`));
                });
    
                // Add timeout
                const timeout = setTimeout(() => {
                    console.error('[Debug] Python command timed out');
                    childProcess.kill();
                    reject(new Error('Command timed out'));
                }, 30000); // 30 second timeout
    
                childProcess.on('close', (code) => {
                    clearTimeout(timeout);
                    console.error(`[Debug] Python process exited with code ${code}`);
                    if (code === 0) {
                        resolve(output.trim());
                    } else {
                        reject(new Error(errorOutput || `Command failed with exit code ${code}`));
                    }
                });
            });
        }

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/jmanhype/dart-mcp-server'

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