Skip to main content
Glama
sonisoft-cnanda

now-sdk-ext-mcp

Code Search

code_search
Read-only

Search a ServiceNow instance for scripts, business rules, and includes matching a term, returning record names, tables, fields, and line numbers with context.

Instructions

Search for code across a ServiceNow instance using the Code Search API. Finds matching scripts, business rules, script includes, and other code artifacts across the platform. Results include the record name, table, field, and matching line numbers with context.

Code Search works through Search Groups, which define sets of tables and fields to search. There is typically a default search group. Use list_code_search_groups to discover available groups, and list_code_search_tables to see which tables a group covers.

Key use cases:

  • Find scripts that reference a specific API, table, or pattern

  • Locate business rules, script includes, or UI scripts containing specific logic

  • Verify whether code has been deployed to an instance

  • Search within a specific application scope or table

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
termYesThe search term to find in code. Searches across script fields in the tables defined by the search group.
limitNoMaximum number of results to return.
tableNoSpecific table to search within (e.g., "sys_script_include"). Requires `search_group` to also be specified. Use `list_code_search_tables` to see available tables for a group.
instanceNoThe ServiceNow instance auth alias (e.g., "myinstance", "prod"). If not provided, falls back to the SN_AUTH_ALIAS environment variable.
current_appNoApplication scope to limit results to (e.g., "x_myapp"). When set, only results from this application scope are returned. Automatically sets search_all_scopes to false.
search_groupNoThe search group NAME to scope the search (e.g., "Default Code Search Group"). If omitted, the instance's default search group is used. Use `list_code_search_groups` to discover available groups.
search_all_scopesNoWhen false, limits results to files within the scope specified by `current_app`. Defaults to true (search all scopes).
Behavior4/5

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

Annotations mark it as read-only and open-world, and the description adds context about search groups, the default search group behavior, and how current_app affects search_all_scopes. It also notes the instance fallback to the SN_AUTH_ALIAS environment variable.

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 with an opening summary, a paragraph on search groups, and a bulleted list of use cases. It is appropriately sized for a non-trivial tool, front-loaded with the primary action, and every sentence contributes value.

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?

The description covers the search group mechanism, result contents (record name, table, field, line numbers), and related discovery tools. It omits explicit mention of pagination or error handling, but for a read-only search tool with rich annotations and schema, it is sufficiently complete.

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?

All seven parameters have schema descriptions, yielding a high schema coverage baseline of 3. The tool description adds conceptual context about search groups, helping to understand the search_group and table parameters, but it does not significantly extend parameter-specific details beyond the schema.

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 searches for code across a ServiceNow instance, identifying scripts, business rules, script includes, and other artifacts. It uses a specific verb+resource structure and distinguishes itself from sibling tools like list_code_search_groups and query_table.

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

Usage Guidelines4/5

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

The description lists concrete use cases, such as finding scripts referencing a specific API, locating business rules, and verifying deployments. It also directs users to list_code_search_groups and list_code_search_tables for discovery, but it does not explicitly state when not to use this tool or name alternatives.

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/sonisoft-cnanda/now-sdk-ext-mcp'

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