Skip to main content
Glama

get_shared_labels

Retrieve shared labels from Todoist to manage collaborative task organization across projects and teams.

Instructions

Get all shared labels from Todoist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'get_shared_labels' tool. It uses createApiHandler to register a tool that makes a GET request to the Todoist API endpoint '/labels/shared' with no input parameters.
    createApiHandler({
        name: 'get_shared_labels',
        description: 'Get all shared labels from Todoist',
        schemaShape: {},
        method: 'GET',
        path: '/labels/shared',
    });
  • The core handler logic for the tool, instantiated by createApiHandler. For get_shared_labels, it resolves the path to '/labels/shared' (no path params), uses empty finalParams, executes todoistApi.get('/labels/shared', {}), and returns the result directly.
    const handler = async (args: z.infer<z.ZodObject<T>>): Promise<R> => {
        let finalPath = options.path;
        const pathParams: Record<string, string> = {};
    
        // Extract path parameters (e.g., {id}) and replace them with actual values
        const pathParamRegex = /{([^}]+)}/g;
        let match;
    
        while ((match = pathParamRegex.exec(options.path)) !== null) {
            const fullMatch = match[0]; // e.g., "{id}"
            const paramName = match[1]; // e.g., "id"
    
            if (args[paramName] === undefined) {
                throw new Error(`Path parameter ${paramName} is required but not provided`);
            }
    
            // Validate and encode path parameter using the centralized security function
            const safeParamValue = validatePathParameter(args[paramName], paramName);
            finalPath = finalPath.replace(fullMatch, safeParamValue);
            pathParams[paramName] = String(args[paramName]);
        }
    
        // Collect non-path parameters for query string or request body
        const otherParams = Object.entries(args).reduce(
            (acc, [key, value]) => {
                if (value !== undefined && !pathParams[key]) {
                    acc[key] = value;
                }
                return acc;
            },
            {} as Record<string, any>
        );
    
        // Apply custom parameter transformation if provided
        const finalParams = options.transformParams ? options.transformParams(args) : otherParams;
    
        // Execute the API request based on HTTP method
        let result;
        switch (options.method) {
            case 'GET':
                result = await todoistApi.get(finalPath, finalParams);
                break;
            case 'POST':
                log('POST', finalPath, finalParams);
                result = await todoistApi.post(finalPath, finalParams);
                break;
            case 'DELETE':
                result = await todoistApi.delete(finalPath);
                break;
        }
    
        // Apply result post-processing if provided
        return options.processResult ? options.processResult(result, args) : result;
    };
  • Input schema for the tool: empty object, indicating no parameters are required.
    schemaShape: {},
  • The createApiHandler factory function that generates and registers the tool handler based on the provided API endpoint configuration.
    export function createApiHandler<T extends z.ZodRawShape, R = any>(options: {
        name: string;
        description: string;
        schemaShape: T;
        method: HttpMethod;
        path: string;
        transformParams?: ParamTransformer<z.infer<z.ZodObject<T>>>;
        processResult?: ResultProcessor<z.infer<z.ZodObject<T>>, R>;
    }) {
        const handler = async (args: z.infer<z.ZodObject<T>>): Promise<R> => {
            let finalPath = options.path;
            const pathParams: Record<string, string> = {};
    
            // Extract path parameters (e.g., {id}) and replace them with actual values
            const pathParamRegex = /{([^}]+)}/g;
            let match;
    
            while ((match = pathParamRegex.exec(options.path)) !== null) {
                const fullMatch = match[0]; // e.g., "{id}"
                const paramName = match[1]; // e.g., "id"
    
                if (args[paramName] === undefined) {
                    throw new Error(`Path parameter ${paramName} is required but not provided`);
                }
    
                // Validate and encode path parameter using the centralized security function
                const safeParamValue = validatePathParameter(args[paramName], paramName);
                finalPath = finalPath.replace(fullMatch, safeParamValue);
                pathParams[paramName] = String(args[paramName]);
            }
    
            // Collect non-path parameters for query string or request body
            const otherParams = Object.entries(args).reduce(
                (acc, [key, value]) => {
                    if (value !== undefined && !pathParams[key]) {
                        acc[key] = value;
                    }
                    return acc;
                },
                {} as Record<string, any>
            );
    
            // Apply custom parameter transformation if provided
            const finalParams = options.transformParams ? options.transformParams(args) : otherParams;
    
            // Execute the API request based on HTTP method
            let result;
            switch (options.method) {
                case 'GET':
                    result = await todoistApi.get(finalPath, finalParams);
                    break;
                case 'POST':
                    log('POST', finalPath, finalParams);
                    result = await todoistApi.post(finalPath, finalParams);
                    break;
                case 'DELETE':
                    result = await todoistApi.delete(finalPath);
                    break;
            }
    
            // Apply result post-processing if provided
            return options.processResult ? options.processResult(result, args) : result;
        };
    
        return createHandler(options.name, options.description, options.schemaShape, handler);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure but only states what the tool does, not how it behaves. It doesn't mention whether this is a read-only operation, if it requires authentication, what format the output takes, or any rate limits or constraints. For a tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the essential purpose without any wasted words. It's appropriately sized for a simple retrieval tool and front-loads the key information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description should provide more context about the tool's behavior, output format, and differentiation from similar tools. As a read operation among many Todoist tools, the minimal description leaves significant gaps in understanding how to properly use this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters with 100% schema description coverage, so the schema already fully documents the parameter situation. The description appropriately doesn't discuss parameters, maintaining focus on the tool's purpose. Baseline for zero parameters is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get all') and resource ('shared labels from Todoist'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_labels' or 'get_labels_list', which could cause confusion about when to use each tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_labels' or 'get_labels_list'. There's no mention of prerequisites, context, or comparison with sibling tools, leaving the agent to guess about appropriate usage scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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/stanislavlysenko0912/todoist-mcp-server'

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