Skip to main content
Glama
kj455

MCP Kibela

by kj455

kibela_search_notes

Search your Kibela notes using a query to locate specific information. Access relevant content from your team's knowledge base.

Instructions

Search Kibela notes by query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query

Implementation Reference

  • The handler function that executes the tool logic. It validates the 'query' argument, calls the GraphQL searchNotes function, extracts document nodes from search results, and returns them as JSON text.
    handler: async (args) => {
      if (!args.query) {
        throw new Error('Query is required')
      }
    
      const response = await searchNotes({ query: args.query })
    
      const edges = response.search?.edges ?? []
      const notes = edges
        .filter((edge): edge is NonNullable<(typeof edges)[number]> => edge != null)
        .filter((edge) => edge.node?.document != null)
        .map((edge) => edge.node?.document)
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(notes, null, 2),
          },
        ],
      }
    },
  • Input schema and type definitions for the tool. Defines SearchNotesArgs type (query: string) and the inputSchema with required 'query' string property.
    export type SearchNotesArgs = {
      query: string
    }
    
    export const searchNotesTool: ToolDefinition<SearchNotesArgs> = {
      tool: {
        name: 'kibela_search_notes',
        description: 'Search Kibela notes by query',
        inputSchema: {
          type: 'object',
          properties: {
            query: {
              type: 'string',
              description: 'Search query',
            },
          },
          required: ['query'],
        },
      },
  • Registration of the tool in the toolDefinitions map. Maps the name 'kibela_search_notes' to the searchNotesTool definition, which is later exported via TOOLS and dispatched via handleToolRequest.
    const toolDefinitions = {
      kibela_search_notes: searchNotesTool,
      kibela_get_my_notes: getMyNotesTool,
      kibela_get_note_content: getNoteContentTool,
      kibela_get_note_from_path: getNoteFromPathTool,
      kibela_update_note_content: updateNoteContentTool,
      kibela_create_note: createNoteTool,
    } as const
  • GraphQL query helper that defines the 'searchNotes' query (SearchNotes query with query variable, returning up to 15 results with id/title/url) and the searchNotes function that executes it via gqlRequest.
    import { TypedDocumentNode } from '@graphql-typed-document-node/core'
    import { gql } from 'graphql-tag'
    import { gqlRequest } from '../request'
    
    type SearchNotesResponse = {
      search: {
        edges: {
          node: {
            document: {
              id: string
              title: string
              url: string
            }
          }
        }[]
      }
    }
    
    type SearchNotesVariables = {
      query: string
    }
    
    const searchNotesQuery: TypedDocumentNode<SearchNotesResponse, SearchNotesVariables> = gql`
      query SearchNotes($query: String!) {
        search(query: $query, first: 15) {
          edges {
            node {
              document {
                ... on Note {
                  id
                  title
                  url
                }
              }
            }
          }
        }
      }
    `
    
    export async function searchNotes(variables: SearchNotesVariables): Promise<SearchNotesResponse> {
      return gqlRequest(searchNotesQuery, variables)
    }
  • Generic GraphQL request helper (gqlRequest) that sends the query to the Kibela API endpoint using environment variables for team and token authentication.
    export async function gqlRequest<TData, TVariables>(
      query: TypedDocumentNode<TData, TVariables>,
      variables: TVariables,
    ): Promise<TData> {
      const queryString = query.loc?.source.body ?? ''
      if (!queryString) {
        throw new Error('Failed to get query string')
      }
    
      console.error('Query:', queryString)
      console.error('Variables:', variables)
    
      const response = await fetch(`https://${env.KIBELA_TEAM}.kibe.la/api/v1`, {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          Authorization: `Bearer ${env.KIBELA_TOKEN}`,
        },
        body: JSON.stringify({
          query: queryString,
          variables,
        }),
      })
    
      if (!response.ok) {
        const errorText = await response.text()
        console.error('Response:', errorText)
        throw new Error(`HTTP error! status: ${response.status}, body: ${errorText}`)
      }
    
      const json = await response.json()
      const typedJson = json as { errors?: Array<{ message: string }>; data: TData }
      if (typedJson.errors) {
        throw new Error(typedJson.errors[0].message)
      }
    
      return typedJson.data
    }
Behavior2/5

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

With no annotations, the description is expected to disclose behavioral traits. It only states the basic function without explaining what the output looks like, whether it is read-only, or any limitations. This is insufficient for an agent to predict behavior.

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

Conciseness3/5

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

The description is a single sentence and front-loaded with the purpose. However, it is overly brief and lacks context that would improve usability without adding much length.

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 an output schema, the description should at least hint at the return format (e.g., list of note titles or full content). It also does not mention any limitations like pagination or search scope, leaving the tool incomplete for an agent.

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

Parameters3/5

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

The input schema has 100% coverage with a single parameter described as 'Search query'. The description adds no extra meaning beyond the schema, so the baseline score of 3 is appropriate.

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 verb (search) and resource (Kibela notes), and the query parameter is implied. However, it does not differentiate from sibling tools like 'kibela_get_my_notes' or 'kibela_get_note_content', which could lead to confusion about scope.

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?

No guidance is provided on when to use this tool versus alternatives. There is no mention of when to search versus fetch specific notes or lists.

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/kj455/mcp-kibela'

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