-
Notifications
You must be signed in to change notification settings - Fork 6
Add custom fields and creating/updating test cases with custom fields #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ramilamparo
wants to merge
18
commits into
main
Choose a base branch
from
dev/ram/custom-fields-mcp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a4c095a
Code refactoring and organization
ramilamparo 9c313cd
Remove unused import
ramilamparo 24341ed
Add bulk_upsert_folders tool
ramilamparo 96afd19
Add create_test_case tool
ramilamparo 3f106fa
Fix import paths
ramilamparo 1fd2fa1
Merge branch 'dev/ram/refactoring' into dev/ram/tcase-automation-tools
ramilamparo 6ecebda
Add update_test_case
ramilamparo 1de8f07
Tweaks
ramilamparo 2c98b8e
Fix sanity check
ramilamparo 6a3e162
Merge branch 'dev/ram/refactoring' into dev/ram/tcase-automation-tools
ramilamparo c7f5a68
Merge branch 'main' into dev/ram/tcase-automation-tools
ramilamparo 4f05c04
Minor refactoring
ramilamparo bbaff79
Add list_custom_fields tool. Add creating/updating test cases with cu…
ramilamparo bc87914
Minor refactoring
ramilamparo bbecf4a
Merge branch 'dev/ram/tcase-automation-tools' into dev/ram/custom-fie…
ramilamparo 737ce5d
Merge branch 'main' into dev/ram/custom-fields-mcp
ramilamparo c807a51
Improve schema, and add AI feedbacks
ramilamparo 8b259b1
Fix comments
ramilamparo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp' | ||
| import axios from 'axios' | ||
| import { QASPHERE_API_KEY, QASPHERE_TENANT_URL } from '../config.js' | ||
| import type { CustomFieldsResponse } from '../types.js' | ||
| import { projectCodeSchema } from '../schemas.js' | ||
|
|
||
| export const registerTools = (server: McpServer) => { | ||
| server.tool( | ||
| 'list_custom_fields', | ||
| "List all custom fields available for a project. This endpoint is useful when creating or updating test cases that include custom field values. Custom fields allow you to extend test cases with additional metadata specific to your organization's needs.", | ||
| { | ||
| projectCode: projectCodeSchema, | ||
| }, | ||
| async ({ projectCode }: { projectCode: string }) => { | ||
| try { | ||
| const response = await axios.get<CustomFieldsResponse>( | ||
| `${QASPHERE_TENANT_URL}/api/public/v0/project/${projectCode}/custom-field`, | ||
| { | ||
| headers: { | ||
| Authorization: `ApiKey ${QASPHERE_API_KEY}`, | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| } | ||
| ) | ||
|
|
||
| return { | ||
| content: [ | ||
| { | ||
| type: 'text', | ||
| text: JSON.stringify(response.data.customFields), | ||
| }, | ||
| ], | ||
| } | ||
| } catch (error: unknown) { | ||
| if (axios.isAxiosError(error)) { | ||
| switch (error.response?.status) { | ||
| case 404: | ||
| throw new Error(`Project with code '${projectCode}' not found.`) | ||
| case 401: | ||
| throw new Error('Invalid or missing API key') | ||
| case 403: | ||
| throw new Error('Insufficient permissions or suspended tenant') | ||
| default: | ||
| throw new Error( | ||
| `Failed to fetch custom fields: ${error.response?.data?.message || error.message}` | ||
| ) | ||
| } | ||
| } | ||
| throw error | ||
| } | ||
| } | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question - how does AI infer that the key should be the system name ?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In zod schema, there is information about it
but I am not sure if this information reaches the AI agent.