Skip to main content
Glama
knishioka

Treasure Data MCP Server

by knishioka

td_get_project_by_name

Retrieve complete project details by providing the exact project name instead of ID, eliminating the need for separate find and get operations.

Instructions

Get full project details using exact name instead of ID.

Convenient shortcut when you know the exact project name.
Combines find + get operations for immediate detailed results.

Common scenarios:
- User provides exact project name, need full details
- Quick project metadata lookup by name
- Avoiding two-step process (find ID then get details)
- Getting revision/timestamps for known project

Requires exact name match. For fuzzy search use td_find_project.
Returns same details as td_get_project but using name lookup.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_nameYes

Implementation Reference

  • Main execution logic for td_get_project_by_name tool: finds project by exact name using td_find_project helper, then retrieves full details via client.get_project.
    async def td_get_project_by_name(
        project_name: str,
    ) -> dict[str, Any]:
        """Get full project details using exact name instead of ID.
    
        Convenient shortcut when you know the exact project name.
        Combines find + get operations for immediate detailed results.
    
        Common scenarios:
        - User provides exact project name, need full details
        - Quick project metadata lookup by name
        - Avoiding two-step process (find ID then get details)
        - Getting revision/timestamps for known project
    
        Requires exact name match. For fuzzy search use td_find_project.
        Returns same details as td_get_project but using name lookup.
        """
        if not project_name or not project_name.strip():
            return _format_error_response("Project name cannot be empty")
    
        # Use find_project with exact match
        search_result = await td_find_project(project_name, exact_match=True)
    
        if search_result.get("found") and search_result.get("projects"):
            project = search_result["projects"][0]
    
            # Get full details using td_get_project
            client = _create_client(include_workflow=True)
            if isinstance(client, dict):
                return client
    
            try:
                full_project = client.get_project(project["id"])
                if full_project:
                    return {"project": full_project.model_dump()}
                else:
                    return _format_error_response(
                        f"Could not retrieve details for project '{project_name}'"
                    )
            except Exception as e:
                return _format_error_response(f"Failed to get project details: {str(e)}")
    
        return _format_error_response(f"Project '{project_name}' not found")
  • Registration of the td_get_project_by_name tool (and others) using mcp.tool() decorator within the register_mcp_tools function.
    mcp.tool()(td_find_project)
    mcp.tool()(td_find_workflow)
    mcp.tool()(td_get_project_by_name)
    mcp.tool()(td_smart_search)
  • Helper function td_find_project used by td_get_project_by_name to locate project ID by name (exact or fuzzy matching across projects and workflows).
    async def td_find_project(
        search_term: str,
        exact_match: bool = False,
    ) -> dict[str, Any]:
        """Find project by name when you don't know the exact ID.
    
        Searches all projects and returns matches. Useful when you know project
        name but need the ID for other operations like downloading archives.
    
        Common scenarios:
        - User mentions project name, need to find ID
        - Looking for projects containing specific keywords
        - Getting project ID before using td_download_project_archive
        - Finding multiple projects with similar names
    
        Use exact_match=True for precise name matching, False for fuzzy search.
        Returns project IDs, names, and metadata for all matches.
        """
        if not search_term or not search_term.strip():
            return _format_error_response("Search term cannot be empty")
    
        client = _create_client(include_workflow=True)
        if isinstance(client, dict):
            return client
    
        try:
            # First, try to get projects directly (up to 200)
            projects = client.get_projects(limit=200, all_results=True)
    
            found_projects = []
            search_lower = search_term.lower()
    
            for project in projects:
                project_name = project.name.lower()
    
                if exact_match:
                    if project_name == search_lower:
                        found_projects.append(project)
                else:
                    if search_lower in project_name:
                        found_projects.append(project)
    
            if found_projects:
                return {
                    "found": True,
                    "count": len(found_projects),
                    "projects": [
                        {
                            "id": p.id,
                            "name": p.name,
                            "created_at": p.created_at,
                            "updated_at": p.updated_at,
                        }
                        for p in found_projects
                    ],
                }
    
            # If not found in projects, search through workflows
            workflows = client.get_workflows(count=1000, all_results=True)
    
            project_map = {}
            for workflow in workflows:
                project_name = workflow.project.name
                project_id = workflow.project.id
    
                if exact_match:
                    if project_name.lower() == search_lower:
                        if project_id not in project_map:
                            project_map[project_id] = {
                                "id": project_id,
                                "name": project_name,
                                "workflow_count": 0,
                            }
                        project_map[project_id]["workflow_count"] += 1
                else:
                    if search_lower in project_name.lower():
                        if project_id not in project_map:
                            project_map[project_id] = {
                                "id": project_id,
                                "name": project_name,
                                "workflow_count": 0,
                            }
                        project_map[project_id]["workflow_count"] += 1
    
            if project_map:
                # Get full project details for found projects
                projects_with_details = []
                for project_id, project_info in project_map.items():
                    try:
                        project = client.get_project(project_id)
                        if project:
                            projects_with_details.append(
                                {
                                    "id": project.id,
                                    "name": project.name,
                                    "created_at": project.created_at,
                                    "updated_at": project.updated_at,
                                    "workflow_count": project_info["workflow_count"],
                                }
                            )
                    except Exception:
                        # Fallback to basic info
                        projects_with_details.append(project_info)
    
                return {
                    "found": True,
                    "count": len(projects_with_details),
                    "projects": projects_with_details,
                    "source": "workflows",
                }
    
            return {
                "found": False,
                "count": 0,
                "message": f"No projects found matching '{search_term}'",
            }
    
        except Exception as e:
            return _format_error_response(f"Failed to search projects: {str(e)}")
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds useful context: it's a 'shortcut' that 'Combines find + get operations,' requires 'exact name match,' and returns 'full project details' including 'revision/timestamps.' However, it doesn't mention error handling, permissions, or rate limits, leaving some behavioral gaps.

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 well-structured and front-loaded with the core purpose. Each sentence adds value: explaining the shortcut benefit, common scenarios, constraints, and alternatives. There's no wasted text, and it efficiently conveys necessary information in a concise manner.

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

Completeness4/5

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

Given the tool's moderate complexity (1 parameter, no output schema, no annotations), the description is largely complete. It covers purpose, usage, constraints, and alternatives. However, without annotations or output schema, it could benefit from more detail on return values or error cases, though the mention of 'full project details' and sibling tool equivalence helps.

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 input schema has 1 parameter with 0% description coverage. The description compensates by explaining the parameter's purpose: 'using exact name' and 'Requires exact name match.' It adds meaning beyond the schema's bare title ('Project Name'), though it doesn't specify format constraints like case sensitivity.

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

Purpose5/5

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

The description clearly states the tool's purpose: 'Get full project details using exact name instead of ID.' It specifies the verb ('Get'), resource ('full project details'), and method ('using exact name'), distinguishing it from sibling tools like td_get_project (which uses ID) and td_find_project (which does fuzzy search).

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool: 'when you know the exact project name' and 'Common scenarios' like quick metadata lookup. It also provides clear alternatives: 'For fuzzy search use td_find_project' and notes it 'Returns same details as td_get_project but using name lookup,' effectively distinguishing it from siblings.

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/knishioka/td-mcp-server'

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