plane-mcp-server icon indicating copy to clipboard operation
plane-mcp-server copied to clipboard

feat: add search issues tools

Open sarahyun02 opened this issue 1 year ago • 3 comments

Description

  • Added search_issues tool in src/tools/search-issues.ts
  • Updated src/tools/index.ts to register the new tool

Usage

The tool can be used to search issues by text query.

Summary by CodeRabbit

  • New Features

    • Added an issue search tool that lets you find issues by a required search term, with optional limit, project filter, and workspace-wide toggle.
    • Returns results in a readable JSON format.
    • Automatically enabled alongside existing tools.
  • Bug Fixes

    • None.
  • Documentation

    • None.
  • Chores

    • Integrated the issue search capability into the default server tooling initialization for immediate availability.

sarahyun02 avatar Sep 17 '25 16:09 sarahyun02

Walkthrough

Adds a new search_issues tool and registers it in the server initialization. The tool builds a query from provided parameters and issues a GET request to Plane’s issues search endpoint using the workspace slug from an environment variable, returning pretty-printed JSON as text content.

Changes

Cohort / File(s) Summary
Tool registration update
src/tools/index.ts
Imports registerSearchIssueTools and invokes registerSearchIssueTools(server) after project tools registration.
Search issues tool
src/tools/search-issues.ts
New module exporting registerSearchIssueTools(server). Registers search_issues tool with params: search (required), limit?, project_id?, workspace_search?. Constructs query via URLSearchParams, calls makePlaneRequest GET workspaces/${process.env.PLANE_WORKSPACE_SLUG}/issues/search/?…, returns pretty-printed JSON text.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as Client
  participant S as MCP Server
  participant T as search_issues Tool
  participant API as Plane API

  U->>S: invoke tool "search_issues"(search, limit?, project_id?, workspace_search?)
  S->>T: execute
  T->>T: Build URLSearchParams (search, limit?, project_id?, workspace_search?)
  T->>API: GET /workspaces/{PLANE_WORKSPACE_SLUG}/issues/search/?query
  API-->>T: JSON response
  T-->>S: Pretty-printed JSON (text)
  S-->>U: content: [{ type: "text", text }]

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I twitch my ears at search so new,
A hop, a query—results in view!
With slug in paw and params tight,
I nose the API for data bright.
Thump-thump! The JSON’s crisp and clear—
Carrots for code, and bugs to fear. 🥕

Pre-merge checks and finishing touches

âś… Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check âś… Passed The title "feat: add search issues tools" is concise, directly describes the primary change (adding the search-issues tool and registering it), and matches the files modified in the changeset, so it accurately summarizes the pull request's main purpose.
Docstring Coverage âś… Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • [ ] 📝 Generate Docstrings
đź§Ş Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

[!TIP]

đź‘® Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

- Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more. - Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Sep 17 '25 16:09 coderabbitai[bot]

In the example provided (pasted below), the endpoint did not include project_id in the path parameter and only had it as a query param.

   async ({ limit, project_id, search, workspace_search }) => {
      // send the params if not null as query string
      const queryParams = new URLSearchParams();
      if (limit) queryParams.set("limit", limit.toString());
      if (project_id) queryParams.set("project_id", project_id);
      if (workspace_search) queryParams.set("workspace_search", workspace_search.toString());
      if (search) queryParams.set("search", search);

      const response = await mcp.makePlaneRequest(
        "GET",
        `workspaces/${mcp.props.workspaceDetail.slug}/issues/search/?${queryParams.toString()}`,
      );
      return {
        content: [

When I follow the example implementation and test the workspace wide issue search, I get a 404 error.

curl -H 'X-API-Key: '\$PLANE_API_KEY 'http://plane-api:8000/api/v1/workspaces/'\$PLANE_WORKSPACE_SLUG'/issues/?search=test&limit=5'"

However, I find that using project_id in the path param correctly returns issues.

curl -H 'X-API-Key: '\$PLANE_API_KEY 'http://plane-api:8000/api/v1/workspaces/'\$PLANE_WORKSPACE_SLUG'/projects/74022669-4ec9-492d-852e-1738580ece65/issues/?search=test&limit=5'"

Is project_id is a required path parameter for the search? Any guidance is extremely appreciated. Thanks in advance.

sarahyun02 avatar Sep 17 '25 21:09 sarahyun02

@sarahyun02 looks like you missed search suffix to the workspace search endpoint

Example curl

curl -H 'X-API-Key: PLANE_API_KEY' http://plane-api:8000/api/v1/workspaces/<slug>/issues/search/?search=test&limit=5

Prashant-Surya avatar Sep 29 '25 09:09 Prashant-Surya